Difference between revisions of "Create new server user"

From Biowikifarm Metawiki
Jump to: navigation, search
m (potentially add user manually to a specific group)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
Note: balance between descriptive user names and those users commonly use
 
Note: balance between descriptive user names and those users commonly use
  
#either in shell script set USERNAME = Test123 - or manually replace for command line
+
<syntaxhighlight lang="bash">
  sudo adduser $USERNAME;  
+
#either in shell script set USERNAME = Test123 - or manually replace for command line
 +
USERNAME="jon-doe" # set USERNAME
 +
FULL_NAME="John Doe"
 +
  sudo adduser "$USERNAME";  
 
  # Add Full name and in Room the city/country plus in Other some information on sponsor or other collobaration context
 
  # Add Full name and in Room the city/country plus in Other some information on sponsor or other collobaration context
  sudo mkdir -p /home/$USERNAME/.ssh;  
+
  sudo mkdir -p "/home/$USERNAME/.ssh";  
  sudo chmod 0700 /home/$USERNAME/.ssh;  
+
  sudo chmod 0700 "/home/$USERNAME/.ssh";  
  sudo chown $USERNAME:$USERNAME /home/$USERNAME/.ssh;  
+
  sudo chown "$USERNAME:$USERNAME" "/home/$USERNAME/.ssh";
  sudo nano /home/$USERNAME/.ssh/authorized_keys;  
+
#######################################
  sudo ls /home/$USERNAME/.ssh -l;  
+
# add public key manually
  sudo chown $USERNAME:$USERNAME /home/$USERNAME/.ssh/authorized_keys;  
+
  sudo nano "/home/$USERNAME/.ssh/authorized_keys";  
  sudo chmod 0600 /home/$USERNAME/.ssh/authorized_keys
+
  sudo ls "/home/$USERNAME/.ssh" -l;  
 
+
  sudo chown "$USERNAME:$USERNAME" "/home/$USERNAME/.ssh/authorized_keys";  
 +
  sudo chmod 0600 "/home/$USERNAME/.ssh/authorized_keys"
 +
#######################################
 
  # this needs to be done manually
 
  # this needs to be done manually
  sudo mkdir /home/$USERNAME\ =\ <enter full name and institution of user>
+
  sudo mkdir "/home/$USERNAME = $FULL_NAME"
 +
#######################################
 +
# potentially add user manually to a specific group
 +
#  list user groups and members
 +
#  awk 'BEGIN {FS=":"}{ print $0}' /etc/group | sort
 +
sudo adduser "$USERNAME" GROUPNAME
 +
</syntaxhighlight>
 
[[Category:User management]]
 
[[Category:User management]]

Latest revision as of 13:33, 4 February 2015

Note: balance between descriptive user names and those users commonly use

#either in shell script set USERNAME = Test123 - or manually replace for command line
USERNAME="jon-doe" # set USERNAME
FULL_NAME="John Doe" 
 sudo adduser "$USERNAME"; 
 # Add Full name and in Room the city/country plus in Other some information on sponsor or other collobaration context
 sudo mkdir -p "/home/$USERNAME/.ssh"; 
 sudo chmod 0700 "/home/$USERNAME/.ssh"; 
 sudo chown "$USERNAME:$USERNAME" "/home/$USERNAME/.ssh";
 #######################################
 # add public key manually
 sudo nano "/home/$USERNAME/.ssh/authorized_keys"; 
 sudo ls "/home/$USERNAME/.ssh" -l; 
 sudo chown "$USERNAME:$USERNAME" "/home/$USERNAME/.ssh/authorized_keys"; 
 sudo chmod 0600 "/home/$USERNAME/.ssh/authorized_keys"
 #######################################
 # this needs to be done manually
 sudo mkdir "/home/$USERNAME = $FULL_NAME"
 #######################################
 # potentially add user manually to a specific group
 #   list user groups and members
 #   awk 'BEGIN {FS=":"}{ print $0}' /etc/group | sort
 sudo adduser "$USERNAME" GROUPNAME