Re: Automating sshfs command
I've made an update of this script.. So it will work in Karmic. And with the newest update of sshfs.
PHP Code:
#!/usr/bin/python
import pexpect
import time
username = "username"
password = "password"
host = "adress.for.the.host"
hostdirectory = "/path/on/host"
mountpoint = "/path/to/mountpoint"
command = "sshfs " + username + "@" + host + ":" + hostdirectory + " " + mountpoint
def start_sshfs():
try:
sshfs = pexpect.spawn(command)
sshfs.expect(username + "@" + host + "'s password: ")
time.sleep (0.1)
sshfs.sendline (password)
time.sleep (10)
sshfs.expect (pexpect.EOF)
except Exception, e:
print str(e)
def main ():
start_sshfs()
if __name__ == '__main__':
main ()
Hope that this will soon be a native feature of the Ubuntu distro. Just a little checkbox when you mount a network/ssh path. "Automount this on startup"
Cheers,
Artheus
Ubuntu server ed. 12.04 x64
Bookmarks