Skip to content
This repository was archived by the owner on Jan 10, 2022. It is now read-only.

User Management

Milad Khakpour edited this page Jan 10, 2020 · 5 revisions

Password (Check /etc/passwd)

Adding User

  • Add user to sudoers
    • add user directly to sudoers
    • add user file to sudoers.d: it is better to have users here as the distribution update can overwrite the "sudoers" file.

File Permission (chmod)

https://www.pluralsight.com/blog/it-ops/linux-file-permissions

Owner/Group/Everyone r(4)/w(2)/x(1) 700 --> rwx------ 644 --> rw-r--r--

Change Owner (chown)

Change Group (chgrp)

User Permission (usermod)

  • we can add user to sudoers or add user to group that has the specific permissions.

man page

  • man -wK "String for search"
  • man -wk command
  • apropos command

public Key Encryption

Local Machine --> Private Key Server --> Public Key

  1. (local) ssh-keygen
  2. (local) two files are created: example exampleAuth & exampleAuth.pub
  3. exampleAuth.pub is going to be copied in Server
  4. (Server) touch ~/.ssh/authorized_key
  5. copy&paste exampleAuth.pub to it
  6. (Server) chmod 700 .shh folder
  7. (Server) chmod 644 ~/.ssh/authorized_key file
  8. (local) ssh user@server-ip -p serverPort -i <path-to-private-key(exampleAuth)>
  9. (Server) disable basic password login
  10. (Server) edit file /etc/ssh/ssh_config and change PasswordAuthentication to no
  11. (Server) restart ssh service service ssh restart or systemctl restart ssh

Link

Clone this wiki locally