Mounting Linux or Windows Folder and File Share into Local Mount Point with Unique Password Character

Posted on

This is an article which is used to describe about how to mount file and folder sharing which is defined in Windows operating system. A host which is installed Linux operating system variant can use ‘mount’ command to be able to mount it.

Imagine if the file and folder sharing defined in Windows system operating system need  to be mounted in Linux using mount command from the command line.

Usually, a default username which can be used is ‘Administrator’ for gaining full access. But how can it by executed in the command line if the password of the ‘Administrator’ account has a unique or a symbol character in it ?. Well, by preceeding the character with the ‘\’ backslash sign, the unique or the symbol character will be considered as just a mere normal character.

Below is the command used in detail to achieve the goal :

mount -t cifs -o username=Administrator,password=\!Password\! //xxx.xxx.xxx.xxxx/SOURCE /mnt

Description : 
mount : The command which is used to do the mounting process of folder and file sharing specified in Windows to the mount point location in Linux
-t : It is the optional parameter defining the type of the filesysttem of folder and file sharing which is going to be mounted. The letter 't' itself can be considered as the abbreviation of type. 
cifs : The filesystem type
-o : It is the optional parameter and it is the abbreviation of option. It is used to specify additional option including username and password which can be used to mount folder and file sharing. 
username : It is an attribute used as an additional option to specify username
Administrator : It is the value of username attribute, in this case it is 'Administrator' 
password : It is an attribute used as an additional option to specify password
\!Password\! : It is the value of password attribute, in this case it is '!Password!', but is is typed as \!Password\! where the '\' is used before the unique character '!' so that the '!' character can be considered as a normal character.

This is an example of the command’s execution :

[root@hostname ]# mount -t cifs -o username=Administrator,password=!Password! //xxx.xxx.xxx.xxx/SOURCE /mnt
-bash: !Password!: event not found
[root@hostname ]#

As shown in the above command’s execution, it failed to be processed since there are unique or symbol character in the password’s value. To solve the problem, the unique or symbol character need to be preceded with the ‘\’ as an escape character. Below is the how to execute the command :

[root@hostname ]# mount -t cifs -o username=Administrator,password=\!Password\! //xxx.xxx.xxx.xxx/SOURCE /mnt 
[root@centos yum.repos.d]# cd /mnt

The mounting process succeed and the location of the new mount point of folder and file sharing is located in /mnt.

One thought on “Mounting Linux or Windows Folder and File Share into Local Mount Point with Unique Password Character

Leave a Reply