To get the home drive and shared folder on a Linux server running Ubuntu 20.4, follow these steps:
-
Open the terminal.
-
Identify the home directory and shared folder.
echo $HOMEThis command will display the path to your home directory.
To find the shared folder, use the following command:
sudo findmnt -no PATH /mntThis command will display the paths of all mounted directories. Look for the shared folder in the output.
-
If the shared folder is not mounted automatically, you can mount it manually. For example, if the shared folder is located at
/mnt/shared, and it is located on the network at//server/shared, you can mount it using the following command:sudo mount -t cifs //server/shared /mnt/shared -o user=username,password=password,guest,nolock,vers=3.0Replace
usernameandpasswordwith your network credentials. -
To make the shared folder automatically mount at boot, create a directory for the configuration files:
sudo mkdir /etc/cifs-utilsThen, create a configuration file for the shared folder:
sudo nano /etc/cifs-utils/smbmount.confAdd the following lines to the file:
workgroup = WORKGROUP client max protocol = SMB3 client ntlm v2 auth = yes client ntlm v1 auth = no client lanman v1 auth = no client lanman v2 auth = noSave and close the file.
Next, create a mount point for the shared folder:
sudo mkdir /mnt/sharedThen, create a mount script:
sudo nano /etc/cifs-utils/shared.mountAdd the following lines to the file:
//server/shared /mnt/shared cifs credentials=/etc/cifs-utils/credentials 0 0Save and close the file.
Finally, create a credentials file:
sudo nano /etc/cifs-utils/credentialsAdd the following lines to the file:
username=username password=passwordSave and close the file.
To make the shared folder mount at boot, add the following line to the
/etc/fstabfile:/etc/cifs-utils/shared.mount /mnt/shared cifs defaults,noauto,x-systemd.automount,x-systemd.delay-start 0 0Save and close the file.
-
To test the configuration, reboot the server or run the following command:
sudo systemctl restart cifs-utilsThe shared folder should now be automatically mounted at
/mnt/shared.
References: