# adduser stduser
Adding user `stduser' ...
Adding new group `stduser' (1004) ...
Adding new user `stduser' (1004) with group `stduser' ...
Creating home directory `/home/stduser' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for stduser
Enter the new value, or press ENTER for the default
        Full Name []: Standard User Template
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y

然後到console上以新帳號登入機器,系統會自己建X-windows的環境:/home/user/Desktop等等等。

因為要使用某些CAD,所以要複製環境變數過來:

# cp /home/olduser/.bashrc /home/newuser/.bashrc
# source .bashrc  <<<啟用環境變數。
# cp /home/olduser/Desktop/anaconda-navigator.desktop /home/newuser/.local/share/application/*.desktop
就會生出anaconda的link。

↑這個作法是每個user要個別設置喔。

 

-----------------如果沒有console可以用,要做下列工作:---------------------------------

# cp -r /home/wanhsuanhsu/* /home/stduser/
# cp -r .* /home/stduser/

# chown -R stduser:stduser /home/stduser/

# ls -al

total 244
drwxr-xr-x 25 stduser stduser  4096  一   8 11:19 .
drwxr-xr-x  8 root    root     4096  一   8 10:43 ..
drwxr-xr-x  3 stduser stduser  4096  一   8 11:18 .anaconda
-rw-------  1 stduser stduser   889  一   8 11:18 .bash_history
-rw-r--r--  1 stduser stduser   220  一   8 11:18 .bash_logout
-rw-r--r--  1 stduser stduser  4266  一   8 11:18 .bashrc
drwxr-xr-x 14 stduser stduser  4096  一   8 11:17 .cache
drwxr-xr-x  3 stduser stduser  4096  一   8 11:18 .conda
-rw-r--r--  1 stduser stduser    40  一   8 11:18 .condarc
drwx------ 13 stduser stduser  4096  一   8 11:17 .config
drwx------  2 stduser stduser  4096  一   8 11:18 .cups
drwxr-xr-x  2 stduser stduser  4096  一   8 11:17 Desktop
drwxr-xr-x  3 stduser stduser  4096  一   8 11:14 Documents
drwxr-xr-x  2 stduser stduser  4096  一   8 11:14 Downloads
drwx------  3 stduser stduser  4096  一   8 11:17 .gnupg
drwxr-xr-x  3 stduser stduser  4096  一   8 11:18 .java
drwxr-xr-x  3 stduser stduser  4096  一   8 11:17 .local
drwx------  2 stduser stduser  4096  一   8 11:18 lost+found
drwxr-xr-x  4 stduser stduser  4096  一   8 11:18 .matlab
drwx------  5 stduser stduser  4096  一   8 11:18 .mozilla
drwxr-xr-x  2 stduser stduser  4096  一   8 11:14 Music
drwx------  3 stduser stduser  4096  一   8 11:17 .nv
-rw-r--r--  1 stduser stduser   310  一   8 11:18 .pam_environment
drwxr-xr-t  2 stduser stduser  4096  一   8 11:18 .pcsc10
drwxr-xr-t  2 stduser stduser  4096  一   8 11:18 .pcsc11
drwxr-xr-x  2 stduser stduser  4096  一   8 11:14 Pictures
drwx------  3 stduser stduser  4096  一   8 11:18 .pki
-rw-r--r--  1 stduser stduser   807  一   8 11:18 .profile
drwxr-xr-x  2 stduser stduser  4096  一   8 11:14 Public
drwxr-xr-x  2 stduser stduser  4096  一   8 11:14 Templates
drwxr-xr-x 12 stduser stduser  4096  一   8 11:14 Videos
-rw-------  1 stduser stduser   102  一   8 11:18 .Xauthority
-rw-r--r--  1 stduser stduser 19939  一   8 11:18 .xorgxrdp.10.log
-rw-r--r--  1 stduser stduser 53416  一   8 11:18 .xorgxrdp.11.log
-rw-------  1 stduser stduser 13601  一   8 11:18 .xsession-errors

使用ssh登入:

login as: stduser
stduser@192.168.1.202's password:
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-58-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

27 updates can be installed immediately.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable

Your Hardware Enablement Stack (HWE) is supported until April 2025.
*** System restart required ***
(base) stduser@rdwks:~$ sudo su
[sudo] password for stduser:
stduser is not in the sudoers file.  This incident will be reported.  <<<<禁止使用su。
(base) stduser@rdwks:~$

--------------------------------------------------------------------

arrow
arrow

    貓熊麗麗 發表在 痞客邦 留言(0) 人氣()