LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-23-2012, 04:55 PM   #1
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,565

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
sshfs mount issues with fstab


Hello all. playing around with sshfs and fstab for mount/umount as user. I have a mount point created by user /usr/rx30/remote and a fstab entry:

Code:
sshfs#rx30@xxx.xxx.xxx.xxx:/usr/rx30 /usr/rx30/remote        fuse    users,noauto,rw 0 0
When I mount /usr/rx30/remote as root i am properly greeted with the p/w and then am able to mount the fuse to the mount point with no issues.

in visudo i have added /bin/mount /usr/rx30/remote, /bin/umount /usr/rx30/remote at the end of the user line.

when i try to mount as user i get permission errors.

Code:
[rx30@rx30 ~]$ mount /usr/rx30/remote/
fuse: failed to exec fusermount: Permission denied
my visudo:

Code:
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL) ALL
rx30    ALL =(root) NOPASSWD: /bin/dmesg -n 1, /usr/rx30/setroute.pl, /usr/bin/copyconfig.sh, /bin/mount -t iso9660 /dev/dvd /mnt/dvd, /bin
/umount /dev/dvd, /usr/bin/runit.sh, /usr/bin/dvd+rw-format -force /dev/dvd, /bin/mount /dev/dvd /mnt/dvd, /bin/mount -t iso9660 /dev/cdrom
 /mnt/cdrom, /bin/umount /mnt/cdrom, /usr/bin/eject, /usr/bin/eject -t, /usr/bin/fixprinter, /bin/mount /mnt/usb, /bin/umount /mnt/usb, /tm
p/formatDev.sh, /bin/chmod, /bin/chown, /bin/cp, /bin/mount /mnt/backup, /bin/umount /bin/backup, /bin/mount /usr/rx30/remote, /bin/umount
/usr/rx30/remote
tdsrmtbk ALL=(root) NOPASSWD: /home/tdsrmtbk/getSystemConfig.sh, /home/tdsrmtbk/setRoute.sh
some guidance would be great. Thanks.
 
Old 04-23-2012, 05:49 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,000
Blog Entries: 11

Rep: Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893
So what happens if you actually try
Code:
sudo mount /usr/rx30/remote/
?
 
Old 04-24-2012, 08:11 AM   #3
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,565

Original Poster
Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
it prompts for password, then craps out saying that my user can not do that.

Code:
[rx30@rx30 ~]$ sudo mount /usr/rx30/remote/
[sudo] password for rx30:
Sorry, user rx30 is not allowed to execute '/bin/mount /usr/rx30/remote/' as root on rx30.localdomain.
 
Old 04-24-2012, 09:38 AM   #4
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,565

Original Poster
Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
but as root this is exactly what I want to happen:

Code:
[root@rx30 ~]# mount /usr/rx30/remote/
rx30@10.10.4.77's password:
[root@rx30 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              65G  9.0G   52G  15% /
tmpfs                 2.0G     0  2.0G   0% /dev/shm
/dev/sda1              97M   32M   61M  35% /boot
/dev/sda2              65G  245M   61G   1% /usr/rx30
rx30@10.10.4.77:/usr/rx30
                     1000G     0 1000G   0% /usr/rx30/remote
well for now. eventually ill want to setup fstab so the user/pw are in there so there is no prompting for the p/w that i can then put into the script.
 
Old 04-24-2012, 03:35 PM   #5
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,565

Original Poster
Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
found the problem. /usr/bin/fusermount didnt have correct permissions.

Code:
# chmod +x /usr/bin/fusermount
this fixed the issue. thank you for the help.
 
Old 04-25-2012, 10:00 AM   #6
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,565

Original Poster
Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
just wanted to add some more notes for those who come after and read this thread.

Snooping around to find a better way of setting up my rsa public key between the 2 servers for the sshfs to work better, i found a nice bit of code that really cuts down on the time and effort setting up the pub/private key pair between systems.

1. On the computer you want to connect FROM generate your rsa key as follows:

Code:
[user@server .ssh]$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/home/web/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/web/.ssh/id_rsa.
Your public key has been saved in /home/web/.ssh/id_rsa.pub.
The key fingerprint is:
90:83:0a:41:be:cd:1a:9a:75:42:2c:28:84:5b:1d:28 user@server
note this is without a pass phrase. This is a very open key and should be handled with caution. I will be using this as a single use key that is restricted to only mounting a specified mount point via sshfs. It will not be allowed to do any other action.

Once the key pair is generated you will want to get the id_rsa.pub to the computer you want to CONNECT TO. this is the nice bit of code I found this morning.

Code:
ssh-copy-id -i ~/.ssh/id_rsa.pub user@IP
This not only copies the public key to the other end, BUT is also populates the appropriate authorized_keys(2) file depending on the type of key you generate (rsa/dsa) and it just works. You are even told how to test the success of the key copy.

Enjoy this little tidbit and the power of sshfs.

(note on performance)

After mounting the sshfs I performed both a cp -Ravf and a rsync -aviS on that mount point to a /tmp/foo and timed this. The mount point contains roughly 3.3G worth of data and we are on a true gigabit LAN. The remote computer is a very old system running a P4 with 1G RAM, while the newer (local) box is a Dell T3500 with Intel(R) Xeon(R) CPU W3503 @ 2.40GHz
4G RAM
so a bit more powerful. Both the cp and the rsync took roughly 1.5min.

Then i ran scp from the other computer to push the same data across the LAN. this took slightly over 2min.

some nice food for thought.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sshfs filesystem mount error jayakumar01 Linux - Server 8 12-23-2011 12:33 PM
SSHFS fstab entries DeadlyMuffin Linux - Software 3 01-07-2010 10:30 AM
sshfs mount testing Murdock1979 Linux - Software 5 05-14-2009 09:18 AM
Permission denied error when trying to mount image contained in sshfs mount openSauce Linux - General 2 03-08-2009 09:50 AM
mount/fstab issues, vfat filename conventions: 8.3 vs long tisource Linux - Software 2 03-23-2005 10:22 PM


All times are GMT -5. The time now is 02:07 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration