Linux slave accounts
Posted: Wed Aug 05, 2015 4:50 am
Just an idea I wanted to bounce off people: Do you think it makes sense to run multiple (per-application?) 'slave' accounts on your operating system? Ie accounts that you can control like puppets, but which have minimal privileges of their own.
I whipped up a simple shell script to make them on standard Linux systems:
Where /etc/slaves/profiles contains only a .profile file to set the umask:
So, the script creates the slave in a new group, gives the master that group and privileges to run any command as the slave and write any of the slave's files, then locks down the slave's home to be untouchable by anyone else. The master can then use slave accounts to run anything that doesn't need direct access to the master's personal files (eg Firefox), or simply manage each set of files (business documents, music, code, etc) in a different slave.
In theory, you could set up sudoers permissions so that each user of the system could use the script to make slaves for him/herself, but not for anyone else. Somewhat like virtualization, but with less isolation and less overhead, more suitable for everyday use.
Does this sound safe/useful?
I whipped up a simple shell script to make them on standard Linux systems:
Code: Select all
#!/bin/sh
MASTER=$1
SLAVE=$2
groupadd $SLAVE
useradd -g $SLAVE -mk /etc/slaves/profile $SLAVE
echo "$MASTER ALL=($SLAVE) NOPASSWD:ALL" > /etc/sudoers.d/$SLAVE
SLAVE_HOME=`grep '^$SLAVE:' /etc/passwd |awk --field-separator=: '{print $6}'`
chmod -Rv o-rwx $SLAVE_HOME
usermod -aG $SLAVE $MASTER
Code: Select all
umask 0007
In theory, you could set up sudoers permissions so that each user of the system could use the script to make slaves for him/herself, but not for anyone else. Somewhat like virtualization, but with less isolation and less overhead, more suitable for everyday use.
Does this sound safe/useful?