dev.nlited.com

>>

Linux: Creating a New User

<<<< prev
next >>>>

2015-12-22 19:38:40 chip Page 1478 📢 PUBLIC

Mon Dec 21 2015

Before I get carried away with creating directories, I want to create a new user named "chip". For some reason, the /home/chip/ directory was not created automatically.


vekolako: sudo su -p useradd chip passwd chip mkdir /home/chip chown chip /home/chip exit sudo su - chip pwd # /home/chip exit

The new user has no configuration at all, so I need to create everything. First, I need to add chip to the sudoers list.


vekolako: sudo vi /etc/sudoers
root ALL=(ALL:ALL) ALL chip ALL=(ALL:ALL) ALL
sudo su - chip sudo ls -la /home/ubuntu [sudo] password for chip: total 36 drwxr-xr-x 4 ubuntu ubuntu 4096 Dec 22 05:11 . drwxr-xr-x 4 root root 4096 Dec 22 05:03 .. -rw------- 1 root root 61 Dec 22 05:04 .bash_history -rw-r--r-- 1 ubuntu ubuntu 220 Apr 9 2014 .bash_logout -rw-r--r-- 1 ubuntu ubuntu 3637 Apr 9 2014 .bashrc drwx------ 2 ubuntu ubuntu 4096 Dec 22 04:44 .cache -rw-r--r-- 1 ubuntu ubuntu 675 Apr 9 2014 .profile drwx------ 2 ubuntu ubuntu 4096 Dec 22 04:42 .ssh -rw------- 1 root root 644 Dec 22 05:11 .viminfo sudo chsh -s /bin/bash chip sudo cp /home/ubuntu/.bashrc . sudo cp /home/ubuntu/.viminfo . sudo cp /home/ubuntu/.profile . sudo chown chip .bashrc .viminfo .profile mkdir .ssh cd .ssh sudo cp /home/ubuntu/.ssh/authorized_keys . sudo chown chip authorized_keys

Append the public key to /home/user/.ssh/authorized_keys. If the file is copied, make sure to change the owner (chown) of the file.

Now I can change the username in my putty profile to "chip" and login using the same key. I edit my .bashrc, then create a symlink from .bash_profile (which is used for interactive logins).
ln -s .bashrc .bash_profile

Get rid of the awful, hideous default colors for vi by editing .vimrc

21:44> Now I have a usable chip profile, and I still have ubuntu in reserve in case the chip profile becomes unusable.



WebV7 (C)2018 nlited | Rendered by tikope in 33.077ms | 3.145.73.167