User Tools

Site Tools


account

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
account [2011/10/28 18:35]
lentinj Adding SSH keysb
account [2016/10/30 09:01] (current)
alex [Creating an Account]
Line 1: Line 1:
 ====== User Account Handling ====== ====== User Account Handling ======
-As there is more than one server that will make up the Wormnet universe, in addition to a few xDSL joined NASes and systems, we need to roll out some kind of central user management database. ​ Naturally we opted for LDAP. 
  
-The packages required to be installed to do this are: +===== Creating an Account =====
-  * [[http://​packages.debian.org/​slapd|slapd]] +
-  * [[http://​packages.debian.org/​nslcd|nslcd]] +
-    * [[http://​packages.debian.org/​libnss-ldapd|libnss-ldapd]] +
-    * [[http://​packages.debian.org/​libpam-ldapd|libpam-ldapd]] +
-  * [[http://​packages.debian.org/​unscd|unscd]]+
  
-===== User Management ===== +  ​root@marmot:​~#​ lvcreate -L 256M -n home-$NEW_USER ​lvm-marmot 
-==== Modifying an Account ==== +  root@marmot:​~#​ mkfs.ext4 -L home-$NEW_USER ​/​dev/​lvm-marmot/​home-$NEW_USER 
-Adding SSH keys, etc. can be done without root access. Do:- +  root@marmot:​~#​ mkdir /​home/​$NEW_USER 
- +  root@marmot:​~# ​[edit /​etc/​fstab ​to mount new user space] 
-  # Set $EDITOR if vi isn't your thing +  ​root@marmot:​~#​ mount /home/$NEW_USER 
-  $ ldapvi --discover -D uid=${USER},​ou=Users,​dc=wormnet,​dc=eu -h ldapi:/// uid=${USER} +  root@marmot:​~# ​useradd -G users,​wormnet-shell -s /bin/bash $NEW_USER 
- +  root@marmot:​~# ​passwd $NEW_USER 
-... and add/remove sshPublicKey lines to your heart'​s delight. +  root@marmot:​~#​ mkdir /home/$NEW_USER/​.ssh 
- +  root@marmot:​~# ​echo "​ssh-rsa AAAB3...KD0pw== ​fred@foobar"​ > /home/$NEW_USER/​.ssh/​authorized_keys 
-==== Creating an Account ==== +  root@marmot:​~#​ tar cC /etc/skel . | tar xC /home/$NEW_USER 
-  root@marmot:​~#​ ldapaddgroup fred +  root@marmot:​~# ​chown -R $NEW_USER:​$NEW_USER ​/home/$NEW_USER 
-  root@marmot:​~#​ ldapadduser fred fred +  root@marmot:​~# ​chmod -R og-r-w-x /​home/​$NEW_USER 
-  Successfully added user fred to LDAP +==== Restricting to Just sftp/scp ==== 
-  Successfully set password for user fred +If you make the users account use the shell ''​/usr/bin/​rssh''​ and edit ''/​etc/​rssh.conf''​ then you can create accounts that can only upload/​download files rather than have a full shell - although you will still need to add them to the 'wormnet-shell' group.
-   +
-  root@marmot:​~#​ passwd fred +
-  LDAP administrator password: +
-  New password: +
-  Retype new password: +
-  passwd: password updated successfully +
-   +
-  root@marmot:​~#​ ldapvi --discover -D cn=admin,​dc=wormnet,​dc=eu -h ldapi:/// uid=fred +
-  objectClass:​ ldapPublicKey +
-  sshPublicKey:​ ssh-rsa AAAB3...aLOOw== wibble +
-  sshPublicKey:​ ssh-rsa AAAB3...KD0pw== fred@foobar +
-   +
-  ​root@marmot:​~#​ lvcreate -L 256M -n home-fred lvm-marmot +
-  root@marmot:​~#​ mkfs.ext4 -L home-fred /​dev/​lvm-marmot/​home-fred +
-  root@marmot:​~# ​vi /​etc/​fstab +
-  ​LABEL=home-fred ​        /home/fred      auto    relatime,​nodev,​nosuid,​noexec ​            ​0 ​ 2 +
-  root@marmot:​~# ​mkdir /home/fred +
-  root@marmot:​~# ​mount /home/fred +
-  root@marmot:​~# ​chown fred:fred /home/fred +
-  root@marmot:​~#​ tar cC /​etc/​skel ​--owner=fred --group=fred ​. | tar xC /home/fred +
-  root@marmot:​~# ​chmod -R og-r-w-x ​/home/fred +
-  ​ +
-  root@marmot:​~# ​ldapvi ​--discover ​-D cn=admin,dc=wormnet,dc=eu -h ldapi:/// cn=wormnet-shell +
-  memberUid: fred+
account.1319823323.txt.gz · Last modified: 2011/10/28 18:35 by lentinj