I know that the default command would look like this:
sudo mount -t cifs -o username=YOUR_USERNAME,password=YOUR_PASSWORD,uid=YOUR_UBUNTU_USERNAME //networkNameOfRemoteComputer/path/to/my/folder /path/to/mounting/dir
However I want to mount a samba share folder without hard coding my password. I consider it a high security risk if the password is visible. Does anyone have an idea?
(In a previous version of this question I also asked for mounting without sudo rights but it seems that this is just not possible :( )
Use the
mount.cifs
command instead, as it allows to specify a credentials file or prompts for a password if none given.Installation
First of all, check you have the needed packages installed by issuing the following command:
METHOD 1 - USING A CREDENTIALS FILE
According to the manual http://manpages.ubuntu.com/manpages/raring/man8/mount.cifs.8.html :
Usage:
Example:
It's important to note that the "name_of_the_user_to_connnect_as" can contain also the domain or the workgroup:
(Depending on you environment, you will need more or less options)
Regarding security, it should be enough to store the credentials file in the /root directory, but if you want to store it elsewhere, just
sudo chown root <file>
METHOD 2 - PASSWORD PROMPT
If as stated, you don't want your password to be visible at all, then just don't provide the "password" option in your
mount.cifs
command.From the manpage at http://manpages.ubuntu.com/manpages/hardy/man8/mount.cifs.8.html
Accordingly, the following command should prompt for a password:
Tested and working as expected: