Mount a Windows share on a GNU/Linux server


sudo mount -t cifs //$WINDOWS_FILE_SERVER/$SHARED_FOLDER /var/www/bytefreaks.net/shared/ -o username=remoteUser,password='123abc',domain=bytefreaks.net,file_mode=0777,dir_mode=0777;

The command sudo mount -t cifs //$WINDOWS_FILE_SERVER/$SHARED_FOLDER /var/www/bytefreaks.net/shared/ -o username=remoteUser,password='123abc',domain=bytefreaks.net,file_mode=0777,dir_mode=0777 is used to mount a shared folder from a Windows file server onto a Linux system.

To break down the command further, here is a detailed explanation of each component:

sudo – this command is used to run the following command as a superuser or root. It is required in this instance as mounting requires administrative privileges.

mount – the mount command is used to mount a file system onto a directory in the Linux file system hierarchy.

-t cifs – this option specifies the type of file system that is being mounted. In this case, it is the Common Internet File System (CIFS), which is used for file sharing between Windows and Linux systems.

//$WINDOWS_FILE_SERVER/$SHARED_FOLDER – this is the network path to the shared folder on the Windows file server. The $WINDOWS_FILE_SERVER and $SHARED_FOLDER are placeholders for the actual Windows file server name and shared folder name, respectively.

/var/www/bytefreaks.net/shared/ – this is the mount point, or the location in the Linux file system hierarchy where the shared folder will be mounted.

-o username=remoteUser,password='123abc',domain=bytefreaks.net,file_mode=0777,dir_mode=0777 – these are the mount options that are specified when mounting the shared folder.

The username option specifies the username of the remote user that has access to the shared folder. In this case, the remote user is named remoteUser.

The password option specifies the password for the remote user.

The domain option specifies the domain or workgroup that the Windows file server belongs to. In this case, the domain is bytefreaks.net.

The file_mode and dir_mode options specify the permissions that should be set on the files and directories within the mounted shared folder. In this case, both are set to 0777, which means that all users have full read, write, and execute permissions on all files and directories within the mounted shared folder.

In summary, the sudo mount -t cifs //$WINDOWS_FILE_SERVER/$SHARED_FOLDER /var/www/bytefreaks.net/shared/ -o username=remoteUser,password='123abc',domain=bytefreaks.net,file_mode=0777,dir_mode=0777 command is used to mount a shared folder from a Windows file server onto a Linux system with the specified mount options.

This post is also available in: Greek

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.