Skip to content

Instantly share code, notes, and snippets.

@shojibMahabub
Last active December 5, 2018 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shojibMahabub/7d09e1f5c5f68486cf96c3d86d1942b9 to your computer and use it in GitHub Desktop.
Save shojibMahabub/7d09e1f5c5f68486cf96c3d86d1942b9 to your computer and use it in GitHub Desktop.
Answers of 6 questions from problem set 3 about linux user and group permission.
1.
For adding a new user, in this case which
is 'mahabub', I will use 'adduser'.
Also I will put the 'gecos' option in order to
do the task non-interactively.
command: adduser --disabled-password --gecos "" mahabub
2.
In order to grant root permission to the user
mahabub I need to edit a file. using the 'visudo'
command I can open that file. And then grant root permission
to the user mahabub in a wayso that he doesn't have
to use password.
command: sudo visudo
mahabub ALL=(ALL) NOPASSWD:ALL
3.
I will use 'mkdir' command for making a .ssh folder in user's (mahabub's)
home directory.
command: mkdir /home/mahabub/.ssh
4.
I will use 'touch' command for making a .ssh folder in user's (mahabub's)
home directory
command: touch /home/mahabub/.ssh/id_rsa
5.
In order to grant the READ-ONLY permission to a user which is not root i will
use 644 (rw-r--r--) permission which is read write for owner, read only for group and user.
command: chmod 644 /home/mahabub/.ssh/id_rsa
6.
I will use 'chown' command to chage the owner of the directory. Also use -R
option in order to make it applicable for all files.
command: sudo chown -R mahabub:group /home/mahabub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment