Ask Your Question
1

mount -t cifs with prompt for password?

asked 2014-09-09 09:29:24 -0500

RogerioOliveira gravatar image

updated 2014-09-10 09:49:25 -0500

FranciscoD_ gravatar image

hello people...

[root@host ~]# mount -t cifs -o username=<share user>,password=<share password>,domain=example.com //WIN_PC_IP/<share name> /mnt

but, i need to write my password into command.

is possible for the command prompt for password?

so no need to expose my password...

thanks.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2014-09-09 09:55:24 -0500

cobra gravatar image

Take a look at the man page for mount.cifs, which explains that if the password=... incantation is omitted, then it will get the password by prompting.

edit flag offensive delete link more

Comments

Per the man page for mount.cifs you could also use a password file or use environment variables to supply the credentials.

swilson gravatar imageswilson ( 2014-09-10 10:15:21 -0500 )edit
0

answered 2014-09-11 03:18:42 -0500

updated 2014-09-11 03:20:34 -0500

You can put the username, password and domain in a file and use the option 'credentials'.

But that still exposes the password in the file.

You can encrypt the file and make a script to decrypt the file into a temporary file, mount the share and remove the temporary file. The script could even be run automatically at startup.

In case you only mount the share manually simply remove the command from the history:

  1. Start by running the command 'history'.
  2. Look up the mount command and remember the line number.
  3. Remove the mount command from the history, by running the following command 'history -d <line number="">'</line>
edit flag offensive delete link more

Comments

1

It's a neat solution to getting the mount done using a stored password that is hidden, but doesn't produce the prompt.

cobra gravatar imagecobra ( 2014-09-11 05:17:41 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-09-09 09:29:24 -0500

Seen: 10,623 times

Last updated: Sep 11 '14