translated by Google

Machine-translated page for increased accessibility for English questioners.

Making discs available on the machine itself

Unix home directory /home/login you can access it on your own or another machine in several ways - via Samba (CIFS), NFS, or SSHFS. Autofs can also be used to simplify connection. The Samba section also shows how to mount the Windows home directory.

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

General information

Commands are used to connect and disconnect mount and umount , you can find more information about them in the manual pages. The directory where you want to access the remote directory is called mountpoint. Mountpoint is not created by calling the mount command - it must exist in advance (this does not apply only to Autofs, where it is created automatically). All mounted (mounted) directories can be displayed with the command mount without parameters.

Samba (CIFS)

Samba access is only available for machines on the FI network and only allows access to the home directory. Samba is generally blocked on the Internet due to frequent abuse. You need root access and a tool on your machine mount.cifs (for example, under Debian available in the package cifs-utils ). Samba export of the home directory is allowed automatically for the entire FI network. Connection requires authentication information. 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 pure form. You can create a file in /etc/samba/fi_cred.conf , set it to 600, and its content should be as follows:

username=login
password=heslo
domain=NTFI

Making the home directory available by itself /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 by the command id ). You can also place these parameters in a single line of a 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 a command to connect

muj_stroj# mount /mnt/fi-home

To disconnect, use the umount command:

muj_stroj# umount /mnt/fi-home

In the case of Samba configuration problems, the command can also be used to test the connection functionality smbclient (usually from the package of the same name) and if successful, a prompt should be displayed smb: \>

Mount the Windows home directory of machines

Command mount it is also possible to attach a folder with home directory and profile of faculty Windows machines. Specify as a 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

NFS

NFS access is only available for machines on the FI network and only allows access to the home directory. However, the currently used version 3 of NFS on the home directory server requires that the UID and primary GID of the user under which you work on your directory machine be the same as the UID and primary GID of the faculty Unix account (this information can be found by id ). So far, 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 that has the required identifiers and then work with the attached files under it. As a result of another NFS specificity, the file permissions you set are fully applied to access these files; that is, if you do not have files available to others, you will not be able to access them under root on your machine.

Again, you need root access and a tool on your machine mount.nfs (for example, under Debian available in the package nfs-common ). You also need to be enabled export home directory NFS protocol (change will take effect within two hours). The connection does not require authentication, so you need to consider the export risk. Accessibility in mountpointe /mnt/fi-home can be executed again 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

Again, the files in the mountpoint are accessible under a user with the same UID and GID;

These parameters can also be included in the file /etc/fstab (see Samba information). Alternatively, an option can be added to the options user To allow directory solder / unsolder an ordinary user (if you want to run programs from mnt is the need for choice user add an option exec - choice user automatically turns it off):

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 a tool installed on your machine sshfs . Depending on your distribution, you may need to add your account to a group that can be soldered using FUSE (see information below). This procedure can be used without any further limitations; the only requirement is a functional login to a faculty machine (Aisa, Anxur, Nymfe, ...). You can attach any directory within your faculty home directory. For example, to attach a faculty directory /home/login/mail into the directory ~/fi-home can be done as follows:

muj_stroj$ sshfs login@aisa:/home/login/mail ~/fi-home

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

Once mounted, the sshfs command remains running in the background and provides access to remote files. Disconnection can be performed by command fusermount :

muj_stroj$ fusermount -u ~/fi-home

Autofs

Autofs can ensure that the directory connects as needed when accessing it and then disconnects if not used for a certain period of time.

To install it, you need root access to the machine and 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 with a configuration for a machine with home directories home.fi.muni.cz. To /etc/auto.master add row

/mnt/net   /etc/auto.home

and the newly created one /etc/auto.home add a line based on the protocol used, the content of which is derived from the fstab lines for that 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

The contents of both lines are wrapped due to their length; in the file, all parameters for each connection must be placed in a single line. Then you have to reload the autofs configuration, for example with the command /etc/init.d/autofs reload or other distribution-specific and autofs should already be functional.

The mountpoint to which the directory connects automatically must not exist. Attempts to access it, however, cause it to be created and connected according to configuration, ie after entering the directory /mnt/net you will not see a directory in the list of its contents, but a command cd fi-home-smb in the case of correct configuration succeeds and the following content listing shows the files in the remote directory. After a period of inactivity, the remote directory is disconnected and the mountpoint is deleted.

Possible problems

Attaching a remote directory to the filesystem will overlap the directory content that we use as a mountpoint. The original directory still exists, but it is not easily accessible until the remote directory is disconnected. However, programs that already have that directory or subdirectory open will see its original content. Therefore, if you were in a mountpointe, mounted a remote directory, and listed its contents, nothing would seem to change. Switching back to that directory will help in this case.

When connecting directories over a network, it is a good idea to be aware of the risk of losing a network connection. In this case, of course, working with the attached directory will no longer work. However, programs that work with content in this directory may also freeze (they get into a state of uninterruptible sleep; 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 forcing a lazy disconnect: umount -lf ; see the command page for more information.

Also, it is not a good idea to forcibly close running sshfs, as it may not be possible to unmount the mounted directory correctly.