Create User on Debian

Users and Groups

Users are located in /etc/passwd
Groups are located in /etc/group

The administrative ROOT account is disabled by default in Ubuntu

.

If you wish to enable the root account, simply give it a password by typing

sudo passwd
To disable the root account
sudo passwd -l root

The initial user created by the Ubuntu installer is a member of the group admin which is added to the file /etc/sudoers as an authorized sudo user. Users added subsequently are not automatically added to groups admin and sudo. Debian does not add the first user to sudoers. You must do that manually – below.

If you are logged in as root, you dont need to use sudo

Create a User
useradd -d /home/username -m username
Set the User’s Password
sudo passwd username
List All Users
cat /etc/passwd
Delete a User
userdel username
Add the User to the Admin Group
adduser username adm
Add user to sudoers (Debian)
usermod -aG sudo username

sudo adduser username sudo
sudo vi /etc/sudoers

give permissions to your new user – below root
username ALL=(ALL:ALL) ALL

List all Groups the User is in
sudo groups username
To temporarily lock or unlock a user account
sudo passwd -l username
sudo passwd -u username
To add or delete a personalized group
sudo addgroup groupname
sudo delgroup groupname
Create User’s SSH keys

no sudo

ssh-keygen -t rsa

no passphrase – [enter] all defaults

Add user to ssh
sudo vi /etc/ssh/sshd_config
AllowUsers username username
sudo /etc/init.d/ssh restart
Set BASH as default shell

chsh -s /bin/bash username

Log out and log back in as username


You may also like...