Day-3: Linux user management and permissions
Mahbub Ferdous Bijoy
Posted on September 30, 2024
- use sudo command to see some confidential or root user access file:
$ cat /var/etc/shadow [you cant see access denied]
$ sudo cat /var/etc/shadow [noew you can see]
$ sudo cat /var/etc/passwd
$ sudo cat /var/etc/group
- add some user by using useradd command:
$ sudo useradd userName
- delete some user by using userdel command:
$ sudo userdel userName
- cahnging some user password :
$ sudo passwd userName
- if we want to know our ssh key :
$ cat ~/.ssh/id_rsa.pub
- connect your machine with remote machine via ssh :
$ ssh -i "key-pair_fileName_PATH ubuntu@ip_address [ubuntu or any os]
- something copy from remote server:
$ scp -i <keypair_PATH> < keypair_PATH> <user@ip_address>: filePath
here all linux permission command:
- check file permission:
$ ls -l
- to change any file permission by using chmod(rwx):
$ chmod +x fileName [make executable file]
$ chmod +rwx fileName [ make permission read,write, executable]
$ chmod -rwx fileName [ remove all permission]
$ chmod -x fileName [remove executable permission]
- we can give permission by using numaric command like 777:
Description: for read - 4, write - 2, execute -1. all together 7. for 777 means 1st 7 for user, 2nd for group and 3rd for all user
$ chmod 777 fileName [all permission for user,group and all]
$ chmod 742 fileName [all permission for user, read for group, write for all]
$ chmod 124 fileName [execute permission for user, write for group, read for all]
$ chmod 711 fileName [ all permission for user, execute for groups and all]
- modifying ownership permission :
$ sudo chown userName fileName [it will change files user ownership]
$ sudo chgrp groupName fileName [it will change files group ownership]
$ sudo chmod userName:groupName fileName [it will change both user & group ownership]
- if you want to change your user password:
$ passwd
- to see our system name :
$ uname
- to see our system name and details:
$ uname -a
$ uname -r [to check only version numaric ]
- add a user to a group :
$ sudo usermod -a -g groupName userName
- remove a user from a group:
$ sudo deluser userName groupName
- Shows information of all the users logged in:
$ finger
- show information of a particular user:
$ finger userName
💖 💪 🙅 🚩
Mahbub Ferdous Bijoy
Posted on September 30, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.