Skip to content

Instantly share code, notes, and snippets.

@SebastiaAgramunt
Last active February 6, 2020 18:08
Show Gist options
  • Save SebastiaAgramunt/895cd43dbb4adedf7b125000c27ae2b9 to your computer and use it in GitHub Desktop.
Save SebastiaAgramunt/895cd43dbb4adedf7b125000c27ae2b9 to your computer and use it in GitHub Desktop.
## Creating user profile for name.surname
# Add a user to the system while creating a folder for him/her
useradd -m name.surname
# Change shell to bash
chsh -s /bin/bash name.surname
# Add user to a group called ai
usermod -a -G ai name.surname
## Adding public keys for remote accessing
# switch to user
su name.surname
# Crate directory and open authorized_keys
mkdir ~/.ssh/ && cd ~/.ssh && nano authorized_keys
# Paste the public key in the terminal and save
################################################
# Delete user and folder
sudo userdel name.surname
sudo rm -r /home/name.surname
# Add user to sudo group
sudo usermod -aG sudo name.surname
# Delete user from sudo group
sudo deluser name.surname sudo
# User changing own password
passwd
# Admin changing other user's password
sudo passwd name.surname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment