Re: SSHFS AUTOmount on Feisty
where can I find my ip address, I use the wireless network provided to me by my college.
when I do
“ifconfig”
I get
eth1 inet addr:10.XXX.XXX.XXX
and
lo inet addr:XXX.XXX.XXX.XXX
now from remote, when I try
ssh @10.XXX.XXX.XXX
its refuse to except my password.
also, from the other blog, i edited /etc/ssh/sshd_config file and I added line
AllowUsers
but its still not working. which IP address I am suppose to use.
also, when I open a website, which gives IP address, it shows my IP address as
127.XXX.XXX.XXX
which is different from 10.XXX.XXX.XXX which i get using “ifconfig”
Thanks
SSHFS AUTOmount on Gutsy...
Thank you very much for the tutorial. I'm running 7.10 (Gutsy Gibbon). There is only one portion that does not work for me; the mountsshfs script. Even if I run it manually, it does not mount my SSHFS share. (The umountsshfs file runs fine.) I can manually mount the SSHFS share using "mount /server/share", so my fstab entry seems to be working correctly.
If I manually mount the SSHFS share, then run mountsshfs, the script appears to hit the line where it calls umountsshfs (because I see the icon to my share disappear from the desktop).
I tried both mountsshfs scripts that were posted, made the chmod/chown modifications, and neither one worked for me.
Thanks again!
Re: SSHFS AUTOmount on Feisty
Quote:
Originally Posted by
cherry316316
where can I find my ip address, I use the wireless network provided to me by my college.
when I do
“ifconfig”
I get
eth1 inet addr:10.XXX.XXX.XXX
and
lo inet addr:XXX.XXX.XXX.XXX
now from remote, when I try
ssh @10.XXX.XXX.XXX
its refuse to except my password.
Are you trying to access it from inside a LAN or outside? To see your IP from the outside world, go to whatismyip.com or something like that. Then you will need to have the SSH port forwarded to your internal IP.
Quote:
also, from the other blog, i edited /etc/ssh/sshd_config file and I added line
AllowUsers
You added your username after that right? You provide a list of usernames after that, and everyone not on the list is blocked. I imagine if you don't list anyone, everyone is blocked. :-)
Re: SSHFS AUTOmount on Feisty
hi, this is where I'm stuck too, in gutsy - you seem to have worked out the problem but there is no post inbetween to say how you did it!
When I run mountsshfs as root or user, nothing happens, no error, no output. umountsshfs works great as does mount ... as user. seems to be something wrong with if-up.d/mountsshfs script maybe but I can't figure out what.
Quote:
Originally Posted by
christian.paratschek
But... Automounting still does not work!
If I execute /etc/network/if-up.d/mountsshfs from a terminal (sudo or as normal user), nothing happens. Permissions are set, file is executable:
-rwxr-xr-x 1 root root 3018 2007-10-29 22:14 mountsshfs
Note: only my non-root user has ssh-keys stored on the server. Root would need a password to ssh into the server. But I didn't set that intentionally, because I thought it is enough to have a normal user have passwordless login. Am I correct?
Regards,
Christian
Re: SSHFS AUTOmount on Fiesty
For Gutsy Users try this as your mountsshfs script.
Code:
#!/bin/bash
## 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.
SELECTED_STRING="sshfs"
# 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"
then
# look for the corresponding name in /etc/passwd
local IFS=":"
while read name x uid the_rest
do
if [ "$1" = "$uid" ]
then
echo "$name"
return 0
fi
done </etc/passwd
else
# look for the username in /etc/passwd
if grep -q "^${1}:" /etc/passwd
then
echo "$1"
return 0
fi
fi
# 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
else
# delete the "uid=" at the beginning
uid_length=`expr length $uid - 3`
uid=`expr substr $uid 5 $uid_length`
echo $uid
return 0
fi
}
# unmount all shares first
bash "/etc/network/if-down.d/umountsshfs"
while read fs mp type opts dump pass extra
do
# check if the line is a selected line
if 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
{ bash -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
mp_uid="#$mp_uid"
fi
{ sudo -u "$mp_uid" bash -c "mount $mp" &&
echo "$mp mounted as $mp_uid" ||
echo "$mp failed to mount as $mp_uid";
} &
else
# otherwise, don't try to mount another user's mount point
echo "Not attempting to mount $mp as other user $mp_uid"
fi
fi
# if not an sshfs line, do nothing
done </etc/fstab
wait
Major difference, changed all (sh)ell calls to (bash) calls and
removed the first conditional statment in the while loop because the # in the sshfs#... fstab line was causing that line to not get evaluated.
Works now after a few hours of tinkering. Thanks.
Re: SSHFS AUTOmount on Feisty
To the people for whom automounting works only from outside their lan:
The difference suggests to me that the issue may be with name resolution. I personally had to jump through some creative hoops to ensure that I could access my server using the same hostname regardless of whether I am on my lan or elsewhere. I am currently using the exact version of the script that appears on the front page of this thread, and it has served me well for months.
Also, one more option to try in your fstab: Compression=yes
This option enables gzip-like compression of transferred data. I haven't done any serious performance testing with this enabled, so I don't know if it actually speeds things up. man ssh_config for more info.
Re: SSHFS AUTOmount on Feisty
Thanks for this Howto. I think with a tiny addaptation it work also for an curlftpfs entry.
I try this...
changed two lines in ifup.d/mountsshfs:
SELECTED_STRING="sshfs|curlftpfs"
elif echo $opts | grep -q -E "comment=($SELECTED_STRING)"; then
also changed one line in ifdown.d/umountsshfs
mounted=`grep -E "(sshfs#|curlftpfs#)" /etc/mtab | awk '{ print $2 }'`
I hope it works. You can see here http://ubuntuforums.org/showthread.php?t=517939 how curlftpfs it set up in your /etc/fstab. I added a "comment=curlftpfs" option similar to your "comment=sshfs" option.
Re: SSHFS AUTOmount on Feisty
Yes, indeed, this script is generalizable to any network file system. This is left as an excercise for the reader.
Re: SSHFS AUTOmount on Feisty
Quote:
Originally Posted by
Darwin Award Winner
Yes, indeed, this script is generalizable to any network file system. This is left as an excercise for the reader.
No reason not to spell out examples, though. Is there a way to do stuff like this through the GUI?
Re: SSHFS AUTOmount on Feisty
If you're looking for a GUI way, you should probably wait until Hardy Heron comes out, featuring the new GVFS system from Gnome, which does let you mount virtual filesystems in the real filesystem.