开发者

gvfs-mount specify username password

Is there anyway to开发者_JAVA技巧 specify / pass a username password to gvfs-mount so that I can run it from a script without it waiting for the user to specify input?


How about using a simple expect script? Something like this...you will need to change...just an outline

#!/usr/local/bin/expect --
set timeout -1
spawn gvfs-mount {args}
expect "User"
send "joe\n"
expect "Password:"
send "xxxxx\n"


smb urls generally work along these lines:

smb://[[domain;]username[:password]@]server[/share[/path]]

I haven't tested gvfs-mount will accept the password like this but certainly it works for username and domain. gvfs-mount can just uses a stored password, if the user has stored one.


This may be an older post but I didn't get it to work when I needed it recently. Now I have found a solution on the german Ubuntu Wiki. It works like a charm now.

Have a file with your login data, leave a blank line if you don't need e.g. the Domain (order as gvfs-mount asks for it):

username
domain
password

Then, in your script, simply call gvfs-mount smb://server/path < path/to/login/data, and here you go! I think you could also do it without a file, passing a string like that: echo 'username\ndomain\npassword' | gvfs-mount smb://server/path, but it didn't work when I tried. I don't know why, it suddenly didn't ask for a password or something...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜