i am using paramiko of python to manipulate access remote linux machine. My command "mount device dir" is failing with " No such file or directory", even though exact the same command succeeds once i use it remotely (connected via ssh, not via paramiko).

I have tried to vary /etc/fstab to some values, again, same situation. Once i type it via ssh - ok, the same command via paramiko - above error message.

Any ideas?

example on command (changed minimally from origin):

        import paramiko
        self.ssh = paramiko.SSHClient()
        self.ssh.connect('', username='root', password='passwd')
        stdin, stdout, stderr = self.ssh.exec_command("/bin/mount /dev/sda1")

gives me an error:

 mount /dev/sda1 failed: mount: mounting /dev/sda1 on /media/card failed: No such file or directory

contents from /etc/fstab:

/dev/sda1       /media/card          vfat      fmask=0000,dmask=0000  0  0

of course, /media/card directory exists. again, i can use above command manually via ssh and it works as expected.

update. meanwhile i tried fabric library of python (built on paramiko), exactly as described in Python - How do I authenticate SSH connection with Fabric module?

c = fabric.Connection(host = '', user = "root", connect_kwargs={'password': 'passwd'})  
c.run("/bin/mount /dev/sda1")  

giving me exactly the same error message as with paramiko directly.

update2. well, as a matter of working around, i mounting drive using direct ssh call, as suggested below in comments. after i do in code whatever necessary, i try to unmount drive using "normal" paramiko call:

self.ssh.exec_command("/bin/umount /dev/sda1")

and it works. so now i am completely lost, mount as above is failing, but unmount is working. this is real strange..

update3. i have tried to extra set LD_LIBRARY_PATH to location of mount's libraries, it needs both libm.so.6 and libc.so.6, both located in /lib like:

self.ssh.exec_command("export LD_LIBRARY_PATH=/lib:/usr/lib && /bin/mount /dev/sda1")

yet no success again.

0 Answers