LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices

Reply
 
Search this Thread
Old 03-27-2014, 01:06 AM   #1
mia_tech
Member
 
Registered: Dec 2007
Location: FL, USA
Distribution: CentOS 5.3, Ubuntu 9.04
Posts: 143

Rep: Reputation: 15
mounting ssh over the network prompt for password everytime


I set up a mount point over an ssh using sshfs. I added this to fstab file
Code:
sshfs#user@192.168.10.10:/home/user /media/ssh fuse user 0 0
but when I run
Code:
sudo mount -a
the remote host prompts me for password. So I exported my ssh key to remote host using
Code:
ssh-keygen
and put it in .ssh/ directory on remote host, but still prompts me for password
 
Old 03-27-2014, 02:10 AM   #2
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Debian, SL
Posts: 5,118

Rep: Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104
Hi,

I suggest you try to get this working just with ssh and then once that works, you can try using sshfs.

So, standard approach:
Code:
ssh -vvvv user@192.169.10.10
If that doesn't provide enough information, the next step is to look in the log from sshd. That would be /var/log/auth.log on Debian derived systems or /var/log/secure on RHEL derived systems.

Finally if you still cant work it out you should run an instance of sshd in debug mode.

There are many threads here on LQ that cover debugging ssh connection problems.

Evo2.
 
Old 03-27-2014, 02:26 AM   #3
mia_tech
Member
 
Registered: Dec 2007
Location: FL, USA
Distribution: CentOS 5.3, Ubuntu 9.04
Posts: 143

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by evo2 View Post
Hi,

I suggest you try to get this working just with ssh and then once that works, you can try using sshfs.

So, standard approach:
Code:
ssh -vvvv user@192.169.10.10
If that doesn't provide enough information, the next step is to look in the log from sshd. That would be /var/log/auth.log on Debian derived systems or /var/log/secure on RHEL derived systems.

Finally if you still cant work it out you should run an instance of sshd in debug mode.

There are many threads here on LQ that cover debugging ssh connection problems.

Evo2.
when I ssh into the host directly, it works
Code:
ssh user@hostname
but when I try to mount
Code:
sudo sshfs user@hostname:/home/user /media/share
it prompts me for authentication on the remote box
 
Old 03-27-2014, 02:44 AM   #4
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Debian, SL
Posts: 5,118

Rep: Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104
Hi,
Quote:
Originally Posted by mia_tech View Post
when I ssh into the host directly, it works
Code:
ssh user@hostname
Ok, good.
Quote:
but when I try to mount
Code:
sudo sshfs user@hostname:/home/user /media/share
it prompts me for authentication on the remote box
Why are you using sudo? Using sudo means that sshfs is being run as root, not by you, and as such will not be using your private key.

Evo2.
 
Old 03-27-2014, 03:30 AM   #5
mia_tech
Member
 
Registered: Dec 2007
Location: FL, USA
Distribution: CentOS 5.3, Ubuntu 9.04
Posts: 143

Original Poster
Rep: Reputation: 15
yes, I know, but I thought that sshfs needed sudo priviliges.... anyways, I tried running without sudo and still didn't work, and it was b/c of permission /media/share was created with sudo, so I had to give it the right permission in order to mount with sshfs..... but now it ask me for passphrase to my key... I guess that when I created the key, I entered a passphrase. I'm gonna have to recreate the key without passphrase... but I think I got it working. It was a permission issue
 
Old 03-27-2014, 03:46 AM   #6
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Debian, SL
Posts: 5,118

Rep: Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104
Hi,

you don't need sudo, you just need to change ownership or permissions of the mount point and to be a member of the fuse group.

See /usr/share/doc/sshfs/README.Debian

Evo2.
 
Old 03-27-2014, 12:37 PM   #7
mia_tech
Member
 
Registered: Dec 2007
Location: FL, USA
Distribution: CentOS 5.3, Ubuntu 9.04
Posts: 143

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by evo2 View Post
Hi,

you don't need sudo, you just need to change ownership or permissions of the mount point and to be a member of the fuse group.

See /usr/share/doc/sshfs/README.Debian

Evo2.
well, I'm almost there. I'm able to login without password and able to mount with sshfs, but I wanted to mount at boot time, so I added
Code:
sshfs#user@192.168.10.10:/home/user	/media/user	fuse	user	0	0
to my /etc/fstab file, but that file runs with different priviliges than mine, so it will not mount. Becuase to execute all mount points on that file I run
Code:
sudo mount -a
and I'm back to square one, how do I get around that?

Last edited by mia_tech; 03-27-2014 at 12:46 PM.
 
Old 04-01-2014, 11:16 AM   #8
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 3,849

Rep: Reputation: 592Reputation: 592Reputation: 592Reputation: 592Reputation: 592Reputation: 592
the system's /etc/fstab acts like root.

for my xbmc machine i put the sshfs command in the users crontab as a @reboot declarative.
 
Old 04-01-2014, 05:29 PM   #9
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Debian, SL
Posts: 5,118

Rep: Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104
Hi,
Quote:
Originally Posted by schneidz View Post
the system's /etc/fstab acts like root.
What do you mean by this? Are your referring to root calling "mount -a" and the mounting of devices that are not tagged "noauto"?

Quote:
for my xbmc machine i put the sshfs command in the users crontab as a @reboot declarative.
That is a separate issue to having entries in /etc/fstab/.

Evo2.
 
Old 04-01-2014, 05:32 PM   #10
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Debian, SL
Posts: 5,118

Rep: Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104
Hi,
Quote:
Originally Posted by mia_tech View Post
to my /etc/fstab file, but that file runs with different priviliges than mine, so it will not mount.
That file does not "run" at all. It is a configuration file read by the mount command.
Quote:
Becuase to execute all mount points on that file I run
Code:
sudo mount -a
and I'm back to square one, how do I get around that?
Why are you running that? You should be doing
Code:
mount /media/user
Evo2.
 
Old 04-01-2014, 05:41 PM   #11
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Debian, SL
Posts: 5,118

Rep: Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104Reputation: 1104
Hi,

one more thing. To prevent root from mounting /media/user, you should add the noauto option. Eg
Code:
sshfs#user@192.168.10.10:/home/user	/media/user	fuse	user,noauto	0	0
If you do want root to mount this for you then (eg via the "mount -a" call at boot time) you can have the remote hosts user accept roots public key (ie add it to the ~/.ssh/authroized_keys file), and specify the uid and gid as mount options. Eg
Code:
sshfs#user@192.168.10.10:/home/user	/media/user	fuse	uid=XXXX,gid=YYYY	0	0
Where XXXX and YYYY are for the local user.

HTH,

Evo2.
 
Old 04-02-2014, 10:50 AM   #12
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 3,849

Rep: Reputation: 592Reputation: 592Reputation: 592Reputation: 592Reputation: 592Reputation: 592
http://www.linuxquestions.org/questi...6/#post5084489

heres mine:
Code:
schneidz@xbmc:~$ cat .profile | tail
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

#/home/schneidz/bin/masq.ksh &
(sleep 45 && /usr/bin/sshfs schneidz@mom:media/stuff hyper) &> /dev/null &
hth.
 
  


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
where does ssh password prompt go? georgewhr Linux - Security 7 06-26-2013 02:53 PM
Mounting Samba share results in network timeout at password prompt (Slackware 12.2) sysfce2 Linux - Newbie 1 10-25-2009 05:43 AM
Delay before password prompt over ssh. cov Linux - Networking 14 07-16-2009 01:53 PM
ssh no password prompt dtra Linux - Software 9 05-25-2005 01:08 PM
ssh without the password prompt markehb Linux - Networking 27 03-25-2004 11:12 AM


All times are GMT -5. The time now is 10:59 PM.

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