Monday, April 8, 2013

Mounting remote folders using ssh and SAMBA


Two ways to mount your remote folders. Use sshfs over unreliable network. Get uid, gid by running id on linux.

mount -t cifs //samba_server/folder ~/yoho/ -o user=username,domain=COMPANY,uid=xxxx'

This will mount remote /folder to local folder ~/yoho.

sshfs -o workaround=rename -o reconnect -o idmap=user -o uid=xxxx -o gid=xxxx -o allow_other username@computer_with_ssh_access.company.com: ~/yuhu/

This will mount the home folder of user username at local folder ~/yuhu.


1 comment:

  1. You can also save the username and password in a text file and pass it in the mount command as:

    mount -t cifs //samba_server/folder ~/yoho/ -o 'credentials=/path/.textfile,domain=COMPANY,uid=xxxx'

    Make sure to chmod 600 .textfile so that it is not readable. Even so your password is in an unencrypted text file...

    For password-less sshfs mount follow this guide:
    http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc.ca/documents/internet/node31.html

    ReplyDelete