Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-01-2010, 10:01 PM
|
#1
|
Senior Member
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,350
Rep:
|
issues with mount.cifs
I want to use sshfs but can't seem to find any info on using public keys, guessing it's not supported. I need a mount method that is automated, so I setup a smb user on the remote server and I use mouunt.cifs and supply the username and password. It mounts ok.
Now I have a windows box which accesses the server (via smb) that has the mount on it, but for whatever reason, I get all sorts of access denied errors when I try to write to that share! I need read and write. How do I go about making this happen?
So just as a recap:
server1 has files that are shared
server2 mounts to server1
client1 mounts to server2, and needs to write to the mount that goes to server1.
|
|
|
12-02-2010, 03:51 PM
|
#2
|
Senior Member
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279
|
Quote:
Originally Posted by Red Squirrel
I want to use sshfs but can't seem to find any info on using public keys, guessing it's not supported. I need a mount method that is automated ...
|
It runs using ssh so it should be transparent.
This guy seems to think so.
|
|
|
12-02-2010, 04:48 PM
|
#4
|
Senior Member
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,350
Original Poster
Rep:
|
I found that post, but there is no real solution. I still need to know the syntax how to specify the key file when I connect to the server that I put the other key file on in ~/.ssh/authorized_hosts. There is no mention about the other key and how I'm suppose to specify it when calling sshfs. That's the part I'm trying to get to work.
|
|
|
12-02-2010, 05:00 PM
|
#5
|
Senior Member
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279
|
You don't specify the key. If you use ssh-agent, you get prompted once for the passphrase for the key on local login. Anytime you use ssh (or sshfs) the key is then supplied. Just make sure the server is set up to request a key.
|
|
|
12-02-2010, 05:05 PM
|
#6
|
Senior Member
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,350
Original Poster
Rep:
|
I don't want to get prompted though. This needs to mount at startup. I want to do the same as my rsync backups, set and forget.
I'm actually debating on just using an rsync job in a loop, but that just seems dirty. Basically I am working on a program off an existing samba share on my main server, but I don't want to run that code on my main server, so from the main server, I just map the data to the test server.
I'm also thinking of going back to what I originally had and worked, have the data reside on the main server, and just have a samba share in my fstab on the test server. I was getting TX Unit Hang errors on that dev server so I thought maybe that was the cause which prompted me to rethink my whole setup, but don't think it was since I'm still getting those errors with the code being local. So more I think about it, think I'll just revert back to what I had.
|
|
|
12-02-2010, 05:07 PM
|
#7
|
Senior Member
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279
|
Well create a public/private keypair with an empty passphrase.
|
|
|
12-02-2010, 05:13 PM
|
#8
|
Senior Member
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,350
Original Poster
Rep:
|
I know that part, but I need to tell sshfs what key I'm using when connecting to the server.
Ex in rsync:
Code:
rsync -rbuv --delete-after --delete-excluded --rsh="ssh -p 22 -i cpdev.key" ${sourcepath} ${pathnamedaily}
For another server I might have another key, and so on, so I need to be able to specify it like I am here. I'm trying to figure out the syntax on how to do this with sshfs.
|
|
|
12-03-2010, 02:00 AM
|
#9
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
you'd offer all keys available by default, you don't need to specify one specifically, unless you're maanging your keys very badly, which is not ssh's fault.
|
|
|
12-03-2010, 05:07 PM
|
#10
|
Senior Member
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279
|
The OP seems to be under the misunderstanding that sshfs is responsible for the initial ssh connection - it isn't.
I suggest getting a new passphrase-less key pair going under a normal ssh connection in a terminal, then script that connection. Use a different user if necessary, you can always make directories public and share-able.
I would also suggest man ssh - there are several clues to the approach and method described there.
Last edited by smoker; 12-03-2010 at 05:09 PM.
|
|
|
12-05-2010, 06:57 AM
|
#11
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339
|
Quote:
Originally Posted by Red Squirrel
I know that part, but I need to tell sshfs what key I'm using when connecting to the server.
Ex in rsync:
Code:
rsync -rbuv --delete-after --delete-excluded --rsh="ssh -p 22 -i cpdev.key" ${sourcepath} ${pathnamedaily}
For another server I might have another key, and so on, so I need to be able to specify it like I am here. I'm trying to figure out the syntax on how to do this with sshfs.
|
You can also put the necessary options in your ~/.ssh/config where you can defines aliases with certain settings of ssh's options which are necessary for a particular host. E.g.:
host fubar
hostname abc.def.invalid
port 33
user your_foreign_name
host *
forwardagent yes
These will be honored automatically when you specify `ssh fubar` or in any `scp` command.
Nevertheless, as I dislike passphraseless ssh-keys, what about hostbased authentication?
|
|
|
12-05-2010, 11:32 AM
|
#12
|
Senior Member
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,350
Original Poster
Rep:
|
That's far from what I'm trying to do. I just want to know the flag on sshfs on how to specify the key to connect with. The other key would already be on the server I'm connecting to. One being the private, the other the public (I always forget which is which, but you get the idea)
Basically in my rsync command, I specify that I'm connecting with the key called cpdev.key which is stored in the same folder as the rsync script. How do I do that with sshfs? I can't seem to find anything online saying what the flag is.
|
|
|
12-05-2010, 11:55 AM
|
#13
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339
|
Quote:
Originally Posted by Red Squirrel
Basically in my rsync command, I specify that I'm connecting with the key called cpdev.key which is stored in the same folder as the rsync script. How do I do that with sshfs? I can't seem to find anything online saying what the flag is.
|
You can try to use a defined alias as I mentioned, where you can specify (man ssh_config):
host fubar-sshfs
hostname abc.def.invalid
IdentityFile cpdev.key
or use:
sshfs -o IdentityFile=cpdev.key ...
|
|
|
12-05-2010, 01:55 PM
|
#14
|
Senior Member
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,350
Original Poster
Rep:
|
sshfs -o IdentityFile=cpdev.key ..
Thanks that's what I needed. I'll try that.
|
|
|
12-25-2010, 12:14 AM
|
#15
|
Senior Member
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,350
Original Poster
Rep:
|
I finally got around to actually trying this, and it did work, this is my final command, in case anyone ever finds this and needs to do it:
Code:
sshfs -p 34 user@site.com:/home/user/folder /localdisk/folder/ -o allow_other -o IdentityFile=/location/to/keyfile
I have another -o option so I had to specify -o again. Without allow_other, only root can access the mounted files.
Something else I never thought of till now, with sshfs, what happens if the connection to the server is lost? When the connection is then available again, will it reconnect?
|
|
|
All times are GMT -5. The time now is 06:10 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|