Load home directories from a server

The setting is the following: I have a pool of 24 computers and about 20 students who need to be able to login at any of the computers and access their data. Basically the normal setup of a computer pool. Of course there are many solutions for this problem (LDAP and so on), but of course it is more fun to create your own solution!

The basic idea is that the home directories are loaded from the server and overwrite the home directories of the clients. The accounts are created directly on each computer, but a user has the same user ID on every computer, so that the mapping of permissions works.

Now for the details. First the server. As a first step, install the NFS server package:

apt-get install nfs-kernel-server

Configure what should be exported. This is done in the file etc/exports:

vi /etc/exports

We want to export the folder /home/ and make it available for all computers in our pool (the subnet 1.22.333.* – of course that’s not the correct IP). So we add this line to the file:

/home/  1.22.333.0/255.255.255.0(rw,async)

We re-read the configuration to let the changes take effect:

exportfs -ra

Now we can check if the correct folder is exported:

exportfs -v

Finally, we create all student accounts on the server. This will also create a home directory for each one. We use fixed user IDs, so for example we will have hans with UID 1010, lisa with UID 1011, kim with UID 1012, and so on.

Now for the clients, where as a first step we need to install the NFS package for the client:

apt-get install nfs-common

Now we could mount the exported folder from the server by hand, but because we want to mount them permanently, we will use the global fstab file for this:

vi /etc/fstab

In this file, insert the following line (where 1.22.333.4 is the server IP):

1.22.333.4:/home/    /home/  nfs     rw,soft 0       0

Restart the computer for the changes to take effect. And finally, again, we need to create all student accounts on each computer and take care to assign the same UID.

Empty panel in XFCE

XFCE has a very annoying property for new users. When you start the desktop for the first time, it asks whether you want to use the “empty panel” or the “default panel”. Unfortunately, people who are new to Linux (and even some that are not so new) have no idea what the question is asking. What you usually want to click is “default panel”. Clicking on “empty panel” will usually result in unhappy users – the desktop will be completely empty. Nothing there, not even a logout button. Bad luck for the newbie.

So in a pool where I expect most users to know little to nothing about Linux, it may be a good idea to simply remove the question completely. This can be done by copying the default panel to a specific place (why? don’t ask me – but it works):

cp /etc/xdg/xfce4/panel/default.xml /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml

If the user already clicked ’empty panel’, the above doesn’t work. What you can do is to get the question back by removing a few files:

rm -r ~/.config/xfce4/xfconf
rm -r ~/.config/xfce4/desktop
rm -r ~/.cache/sessions/

Bash settings

A few settings to be put into the .bashrc.

Ignore duplicates in history, but do put in comands that start with spaces:

HISTCONTROL=ignoredups # (default: ignoreboth)

Keep a lot of history:

export HISTSIZE=10000  # default: 1000
export HISTFILESIZE=10000  # default: 1000

When the shell exits, append to the history file instead of overwriting it:

shopt -s histappend 

Disable the annoying password thingy in KDE:

unset SSH_ASKPASS

Change docker data directory

There are other ways to do this, but a simple one is to replace the default directory with a symbolic link to wherever you want to have your data directory. This is tested with OpenSuse LEAP 42.3.

Stop docker (if it is running):

service docker stop

Move the contents of the docker default data directory (under Suse this is /var/lib/docker/) to somewhere else:

mv /var/lib/docker/ /path/to/new/folder/

Now create a symbolic link to the new location in place of the default directory:

ln -s /path/to/new/folder/ /var/lib/docker/

Start docker again, it should use the new location:

service docker stop

(PS: In my case I had not deleted all containers and images before, so I had some things that linux didn’t want to move to the new location. I just deleted them manually:)

btrfs subvolume delete btrfs/subvolumes/*

sshfs – mount files over ssh

Mount a file system on a different computer via ssh:

sshfs -o follow_symlinks user@server:/home/user/ /path/to/mount/point

server is the other computer, user is your username on the other computer and /home/user/ is the folder you want to include from the other computer. /path/to/mount/point is the place on your drive where the files will be located. It needs to be a folder that exists and is empty.

To get rid of the mounted folder again use

umount /path/to/mount/point