"sudo
" is a command which temporarily gives superuser privileges for a command - hence the name: “super user do”. It is needed for commands which could change the system and thus potentially cause problems.
if you want to edit a configuration file in your home directory, you don’t need sudo it is your file, and if you screw up it only affects you. If on the other hand, you edit a system configuration file in /etc, for example, it can affect other users. It may have even more effects.
If you prefix “sudo” with any command, it will run that command with elevated privileges or in other words allow a user with proper permissions to execute a command as another user, such as the superuser.
This is the equivalent of the “run as administrator” option in Windows. The option of sudo lets us have multiple administrators.
Who can use the sudo command need to have an entry in the sudoers file located at “/etc/sudoers”.
Remember that to edit or view the sudoers file you have to use sudo command. To edit the sudoers file it is recommended to use the “visudo” command.
First, add a new user sudo adduser new username
Check If the user adds or not cat /etc/passwd
Log in to the root user on the new user but the user does not have permission on the root.
sudo su
Edit the sudoers file in the Admin user
sudo cat /etc/sudoers
ibrahim ALL=(ALL:ALL) ALL
Finally, check if working or not
SUID stands for the set user ID. When a file has the SUID bit set, it is executed with the same permission as the file owner and not the permissions of the person who is executing the file.
Root users only have the permission
s - means set user ID
SGID stands for the set group ID. In this case, an executable file with the SGID bit set will have as its group id, the group id of the file owner, and not the person who is executing the file, when being executed.
How to give permission SUID, SGID
touch test1.txt
touch test2.txt
sudo chmod u+s test1.txt
sudo chmod g+s test2.txt
"sticky bit" This permission does not affect individual files. However, at the directory level, it restricts file deletion. Only the owner (and root) of a file can remove the file within that directory.
sudo chmod o+t test3.txt
Thanks for visiting and reading my Blog. I hope you find this useful.