translated by Google

Machine-translated page for increased accessibility for English questioners.

Making disks available on your own machine

Unix home directory /home/login and directory /data/login you can access it on your own or another machine in several ways - via Samba (CIFS), NFS, or SSHFS. Autofs can be used to simplify connection. You will also find a way to mount the Windows home directory in the Samba section.

The tutorials below are for Unix OS. If you want to access the home directory on a Windows machine, you will find the necessary procedure here .

General information

Commands are used to connect and disconnect mount and umount , more information about them can be found, for example, in the manual pages. The directory in which you want to access the remote directory is called mountpoint. Mountpoint is not created by calling the connection command - it must exist in advance (exception: Autofs can create it automatically). All mounted directories can be displayed with the command mount without parameters.

Samba (CIFS)

Access via Samba is only possible for machines in the FI network and allows access to the home directory or directory /data/login . Samba is generally blocked on the Internet due to its frequent misuse. You need to have root access and a tool on your machine mount.cifs (for example, under Debian, available in the cifs-utils ). Samba directory export is enabled automatically for the entire FI network. The connection requires authentication data. From a security point of view, it is best to save them in a file that only root can access, because it contains the faculty password in a clean form. We can create the file, for example, in /etc/samba/fi_cred.conf , set its access rights to 600 and its contents should be as follows:

username=login
password=heslo
domain=NTFI

Making your home directory available to /mnt/fi-home can be done with the command mount :

muj_stroj# mount -t cifs //home.fi.muni.cz/login /mnt/fi-home \
    -o uid=muj_login,gid=skup,credentials=/etc/samba/fi_cred.conf

The uid and gid parameters are the login and primary group on your machine (can be found out with the command id ). You can also place these parameters in a single line of the file /etc/fstab :

//home.fi.muni.cz/login    /mnt/fi-home    cifs
    uid=muj_login,gid=skup,credentials=/etc/samba/fi_cred.conf  0  0

and then just a command to connect

muj_stroj# mount /mnt/fi-home

You can unmount with the umount command:

muj_stroj# umount /mnt/fi-home

Make the directory available /data/login similarly, only the path to the remote directory will be of the form //home.fi.muni.cz/data-login .

In case of problems with Samba configuration, the functionality of the connection can be tested by the command smbclient (in Debian you will find it in the package of the same name). A prompt should appear after a successful connection smb: \>

Mount the home directory of Windows machines (H :)

By order mount you can also mount a folder with the home directory and profile of faculty Windows machines. Specify as the remote directory //ad.fi.muni.cz/DFS/home/login or any of Windows disks , for example:

mount -t cifs //ad.fi.muni.cz/DFS/home/login /mnt/fi-win-home \
    -o uid=muj_login,gid=skup,credentials=/etc/samba/fi_cred.conf
Mount your home directory on Nymph

Connecting to the home directory is also possible without superuser rights thanks to the service GVFS , and therefore also on the Nymphs.

We will connect our home directory and, at the specified request, we will authenticate with the faculty password:

    nymfe$ gio mount "smb://NTFI;$USER@ad.fi.muni.cz/dfs/home/$USER"

It is then possible to access this directory via the Unix file system:

    nymfe$ cd /run/user/$UID/gvfs/smb-share*/profiles/$USER/
    nymfe$ ls

When the session ends, the directory is disconnected automatically, or you can invoke the disconnection manually with this command:

    nymfe$ gio mount -u "smb://NTFI;$USER@ad.fi.muni.cz/dfs/home/$USER"

This method of access is only available from Nymph machines, not from Aisa.

NFS

Access via NFS is only possible for machines in the FI network and allows access to the home directory and directories /data/login . However, the currently used version 3 of the NFS protocol requires that the UID and primary GID of the user under which you will work with the directory on your machine be identical to the UID and primary GID of the faculty Unix account (this information can be found by the command id ). For the time being, this use is more suitable for new installations of the system, where these identifiers can be easily influenced. Alternatively, you can create a new user with the required identifiers and then work with the attached files below it. Due to another NFS specific, the set file permissions are fully applied to access these files; therefore, if you do not have the files available to others, you will not be able to access them even as root on your machine.

Again, you need root access and a tool on your machine mount.nfs (for example, under Debian, available in the nfs-common ). You also need to have it enabled export home directory and directories /data/login NFS protocol (the change will take effect within two hours). The connection does not require authentication, so you need to consider the risk associated with the export. Make the home directory available in the mountpoint /mnt/fi-home can be done with the command mount with the following options:

muj_stroj# mount -t nfs home.fi.muni.cz:/export/home/login /mnt/fi-home \
    -o rw,noatime,soft,actimeo=30,vers=3,sloppy,addr=147.251.48.3
and for /data/login :
muj_stroj# mount -t nfs home.fi.muni.cz:/export/usrdata/login /mnt/fi-data \
    -o rw,noatime,soft,actimeo=30,vers=3,sloppy,addr=147.251.48.3

Again, remember that the files in the mountpoint are accessible under a user with the same UID and GID, so it is necessary to verify the functionality of the connection under him, not under root.

These parameters can also be specified in a file /etc/fstab (see information in the Samba section). Alternatively, the option can be added user so that the ordinary user can also mount / unmount the directory (if you want to run programs from the mountpoint, you need to select user add a choice exec - choice user turns it off automatically):

home.fi.muni.cz:/export/home/login	/mnt/fi-home    nfs
    rw,user,exec,noatime,soft,actimeo=30,vers=3,sloppy,addr=147.251.48.3  0  0

SSHFS

You need to have the tool installed on your machine sshfs . Depending on the distribution, you may need to add your account to a group that allows you to connect using FUSE (see information below). This procedure can be used without any further restrictions; the only condition is a functional registration for a faculty machine (Aisa, Anxur, Nymfe, ...). You can mount any directory within your faculty home directory or directory /data/login . For example, attaching a faculty directory /home/login/mail to the directory ~/fi-mail can be done as follows:

muj_stroj$ sshfs -o idmap=user login@aisa.fi.muni.cz:/home/login/mail ~/fi-mail

If this command ends with a file access error /etc/fuse.conf , you need to add the user to the fuse group, for example with the command muj_stroj# usermod muj_login -aG fuse ).

Once mounted, the sshfs command remains in the background, securing access to remote files. Disconnection can be realized by a command fusermount :

muj_stroj$ fusermount -u ~/fi-mail

Autofs

Autofs can ensure that a directory is mounted as needed when accessing it, and then disconnected if it is not used for a period of time.

To install it, you need root access to the machine and the package autofs . After installation, you need to edit the contents of the files /etc/auto.master with the main configuration of autofs and /etc/auto.home resp. /etc/auto.data with configuration for the machine with shared directories home.fi.muni.cz. When mounting a home directory to /etc/auto.master add a row

/mnt/net   /etc/auto.home

and to the newly created /etc/auto.home add a line according to the used protocol, the content of which is derived from fstab lines for the given protocol:

# pro pripojovani pres Sambu
fi-home-smb
    -fstype=cifs,uid=muj_login,gid=skup,credentials=/etc/samba/fi_cred.conf
    ://home.fi.muni.cz/login

# pro pripojovani pres NFS
fi-home-nfs
    -rw,user,noatime,soft,actimeo=30,vers=3,sloppy
    home.fi.muni.cz:/export/home/login

When connecting /data/login only the path to the remote volume will be different: in the case of Samba, it will be //home.fi.muni.cz/data-login , in the case of NFS home.fi.muni.cz:/export/usrdata/login .

The contents of both lines are wrapped due to their length; in the file, all parameters for each connection must be located on one line. Then you need to reload the autofs configuration, for example with the command systemctl reload autofs or another specific for your distribution and autofs should already be functional.

The mountpoint to which the directory automatically connects must not exist. However, attempts to access it will trigger its creation and connection according to the configuration, ie after entering the directory /mnt/net you will not see any directory in the listing of its contents, but the command cd fi-home-smb if configured correctly, it succeeds and a subsequent listing of the contents displays the files in the remote directory. After a period of inactivity, the remote directory is disconnected and the mountpoint is deleted.

Possible problems

Mounting a remote directory to the file system will overlap the contents of the directory we use as a mountpoint. The original directory still exists, but is not easily accessible until the remote directory is disconnected. However, programs that already have that directory or subdirectory open will see its original contents. Therefore, if you were in a mountpoint, mounted a remote directory in it, and listed its contents, nothing would seem to change. In this case, switching to this directory again will help.

When connecting directories over a network, it is a good idea to be aware of the risk of losing your network connection. In this case, of course, working with the mounted directory will no longer work. However, programs that work with the contents of this directory may also freeze (go into an uninterrupted sleep state; in the output top state D) and these programs may not respond to the SIGKILL signal ( kill -9 ). Also unmount the directory for Samba and NFS using umount may fail. Sometimes this problem can be partially solved by forced line disconnection: umount -lf ; see the command man page for more information umount .

It is also not good to forcibly shut down running sshfs, as it may not be possible to properly unmount the mounted directory.