Skip to content

Instantly share code, notes, and snippets.

@nareshganesan
Created February 28, 2017 09:33
Show Gist options
  • Save nareshganesan/d4d65bdbb65ea288ecb7d4c4ce3aacf4 to your computer and use it in GitHub Desktop.
Save nareshganesan/d4d65bdbb65ea288ecb7d4c4ce3aacf4 to your computer and use it in GitHub Desktop.
# to find os details
uname -a
# 1. Add / update / delete / list - users in linux os
# list all user in linux
cat /etc/passwd # also /etc/passwd, /etc/group and /etc/shadow or /etc/master.passwd could be used
# sample output for list users:
root:x:0:0:root:/root:/bin/bash - root is the username
daemon:x:1:1:daemon:/usr/sbin - daemon is the username
# to create new user login for linux os.
sudo useradd -d /path/to/home/USERNAME USERNAME
sudo passwd USERNAME # asks for new password for the account.
# to create new user login and add to existing group
sudo useradd -G group1,group2 -d /path/to/home USERNAME
# to remove user login from linux os.
userdel -r USERNAME # -r option remove user owned home folder
# to update user password for linux.
sudo passwd USERNAME
# 2. Add / update / delete / list - groups in linux os
# to list all groups
groups
# to create a new user group
groupadd GROUPNAME
# 3. SSH stuff
# update remote host key in ~/.ssh/known_hosts
ssh-keygen -R "ip address"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment