Popular Commands For User Management In Ubuntu
List all Users:
cut -d':' -f 1 /etc/passwdList all Groups:
cut -d':' -f 1 /etc/groupAdd current user to a group:
sudo usermod -aG <groupname> $USERAdd a new user to System:
sudo adduser new_usernameTo remove/delete user:
sudo userdel usernameOr delete the username from the home directory to deleted user account:
sudo rm -r /home/usernameTo modify user:
- Change username:
sudo usermod -l new_username old_usernameChange username in Linux/Ubuntu command.
- change user password:
sudo passwd usernamechange user password in Linux/Ubuntu command.
See file permissions:
ls -l <filename>Example Output:
rw-rw-rw- 1 root docker 0 Nov 28 05:27 docker.sockBreakdown of Each Component:
rw-rw-rw-: These are the file permissions:rw-(Owner: Read and write): The file owner can read and write to the socket.rw-(Group: Read and write): Members of the group can read and write to the socket.rw-(Others: Read and write): All other users on the system can read and write to the socket.
1: Number of hard links to the file.root: The owner of the file is therootuser.docker: The group owner of the file is thedockergroup. Members of this group have permission to access the socket.
To identify which process is using a specific port and terminate it:
- Check the process using the port:
sudo lsof -i :<port number>- Terminate the process:
kill -9 <PID>Replace <PID> with the Process ID displayed in the output of the lsof command.
Do you enjoy this blog post?