They offer different flash templates with latest features.

Forgot password
Written by:
Score: 7
votes: 10
Format: Article

 Installing sshfs for File Sharing

Installing sshfs for File Sharing


Manage Hard drive located on a linux mint server from a different linux mint workstation.


Linux Mint 13,


Install openssh-server on the Linux Mint Server

sudo apt-get update

sudo apt-get install openssh-server


Install sshfs on the Linux Mint Workstation

sudo apt-get update

sudo apt-get install sshfs


Create a keypair on the Linux Mint Workstation. Make with key with no password.

ssh-keygen -t rsa


Append the Workstations Public Key to the Server's Key List, from the Linux Mint Workstation

ssh-copy-id -i ~/.ssh/ user@server


Test the passwordless login from the Linux Mint Workstation.

ssh user@server



Automount the harddisk on the Linux Mint Server

sudo apt-get install pysdm

sudo pysdm

Select a partition from the Partition List. Configure it. Mount it Apply it. Rince Repeat.



Automount the shares on the Linux Mint Workstation

Use a text editor for /etc/fstab

sudo nano /etc/fstab


Append the following line. adjust to your user,server,sda1

sshfs#user@server:/media/sda1 /media/sshSda1 fuse comment=sshfs,noauto,users,exec,uid=1000,gid=1000,allow_other,reconnect,transform_symlinks,BatchMode=yes 0 0

sshfs#user@server:/media/sdb1 /media/sshSdb1 fuse comment=sshfs,noauto,users,exec,uid=1000,gid=1000,allow_other,reconnect,transform_symlinks,BatchMode=yes 0 0


Create the Automount Locations

sudo mkdir /media/sshSda1

sudo mkdir /media/sshSdb1

sudo chmod 777 /media/ssh* -Rv


sudo mkdir /media/sshSda1


Use a test editor for /etc/fuse.conf.

sudo nano /etc/fuse.conf

Append the following line



Make /etc/fuse.conf readable

sudo chmod a+r /etc/fuse.conf


More Sshfs automounting

Use a text editor to create the following into /etc/network/if-up.d/mountsshfs

## The script will attempt to mount any fstab entry with an option
## "...,comment=$SELECTED_STRING,..."
## Use this to select specific sshfs mounts rather than all of them.

# Not for loopback
[ "$IFACE" != "lo" ] || exit 0

## define a number of useful functions

## returns true if input contains nothing but the digits 0-9, false otherwise
## so realy, more like isa_positive_integer 
isa_number () {
    ! echo $1 | egrep -q '[^0-9]'
    return $?

## returns true if the given uid or username is that of the current user
am_i () {
        [ "$1" = "`id -u`" ] || [ "$1" = "`id -un`" ]

## takes a username or uid and finds it in /etc/passwd
## echoes the name and returns true on success
## echoes nothing and returns false on failure 
user_from_uid () {
    if isa_number "$1"
                # look for the corresponding name in /etc/passwd
        local IFS=":"
        while read name x uid the_rest
                if [ "$1" = "$uid" ]
                                echo "$name"
                                return 0
        done </etc/passwd
        # look for the username in /etc/passwd
        if grep -q "^${1}:" /etc/passwd
                echo "$1"
                return 0
    # if nothing was found, return false
        return 1

## Parses a string of comma-separated fstab options and finds out the 
## username/uid assigned within them. 
## echoes the found username/uid and returns true if found
## echoes "root" and returns false if none found
uid_from_fs_opts () {
        local uid=`echo $1 | egrep -o 'uid=[^,]+'`
        if [ -z "$uid" ]; then
                # no uid was specified, so default is root
                echo "root"
                return 1
                # delete the "uid=" at the beginning
                uid_length=`expr length $uid - 3`
                uid=`expr substr $uid 5 $uid_length`
                echo $uid
                return 0

# unmount all shares first
sh "/etc/network/if-down.d/umountsshfs"

while read fs mp type opts dump pass extra
    # check validity of line
    if [ -z "$pass" -o -n "$extra" -o "`expr substr ${fs}x 1 1`" = "#" ]; 
        # line is invalid or a comment, so skip it

    # check if the line is a selected line
    elif echo $opts | grep -q "comment=$SELECTED_STRING"; then

        # get the uid of the mount
        mp_uid=`uid_from_fs_opts $opts`

        if am_i "$mp_uid"; then
                        # current user owns the mount, so mount it normally
                        { sh -c "mount $mp" && 
                                echo "$mp mounted as current user (`id -un`)" || 
                                echo "$mp failed to mount as current user (`id -un`)"; 
                        } &
                elif am_i root; then
                        # running as root, so sudo mount as user
                        if isa_number "$mp_uid"; then
                                # sudo wants a "#" sign icon front of a numeric uid
                        { sudo -u "$mp_uid" sh -c "mount $mp" && 
                                echo "$mp mounted as $mp_uid" || 
                                echo "$mp failed to mount as $mp_uid"; 
                        } &
                        # otherwise, don't try to mount another user's mount point
                        echo "Not attempting to mount $mp as other user $mp_uid"
                        echo "Not attempting to mount $mp as other user $mp_uid"
    # if not an sshfs line, do nothing
done </etc/fstab




With a text editor create the file /etc/network/if-down.d/sshumount

# Not for loopback!
[ "$IFACE" != "lo" ] || exit 0

# comment this for testing
exec 1>/dev/null # squelch output for non-interactive

# umount all sshfs mounts
mounted=`grep 'fuse.sshfs\|sshfs#' /etc/mtab | awk '{ print $2 }'`
[ -n "$mounted" ] && { for mount in $mounted; do umount -l $mount; done; }


A permanente file sharing connection has been accomplished through the use of sshfs.

Tags: sshfs, autofs, File, Folder, Share, network share
Created: 5 years ago.
Last edited: 5 years ago.
Reviewed: 5 years ago.
Read 0 times.

4 years ago

What am I missing here?
Thanks all

ssh-copy-id -i ~/.ssh/ user@server
ssh: connect to host server port 22: Connection timed out
4 years ago

I would also add that your user needs to be added to the fuse user group.

sude adduser fuse

Other tutorials from grimdestripador