A shared playground on Ubuntu

After setting up a machine, I’d like to set up a bunch of users who can log in and give them a common space in which to do some work. The goal is convenience for demonstration and education.

Assume usernames are in a file called names.txt, one per line. This will create users with those names, put them in the users group, and make their passwords “none“. As root:

cat names.txt | while read line
 do
  adduser --gecos "" --disabled-password $line
  adduser $line users
  echo $line:none | chpasswd
 done

Now those users should really log in and change their passwords with passwd. Up next, we make a shared directory that everybody has access to.

mkdir /home/shared
chgrp users /home/shared
chmod g+w /home/shared
chmod g+s /home/shared

That makes the directory, sets the group to users, gives group members write access, and sets the “sticky” bit so that files created in the directory will have the users group.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s