Nemo file manager connection to host using SSH with KEY

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
fbachofner
Level 3
Level 3
Posts: 101
Joined: Sun Aug 08, 2010 6:49 pm
Location: Seaside, CA

Nemo file manager connection to host using SSH with KEY

Post by fbachofner »

One of the things I really love about SSH is that OpenSSH-Server (and others, I believe) automatically "expose" the file system for secure, ad-hoc file transfer without needing to setup Samba, (S)FTP, or similar.

As SSH "best" practices generally call for passwordless connection utilizing SSH keys (I use ed25519 keys), I have been converting connections to this standard, not just among my own household and business, but also clients and other people whom I help with computers.

This leaves a problem, however.

While Nemo seems to automatically use the key(s?) of a logged in user's SSH personal configuration folder (i.e. generally in ~/.ssh/ ), there does not seem to be a way to log in using a key stored elsewhere.

IOW, if I want to log into a host as me, it works fine, but as "another_user" . . . well, the "connect to server" dialog offers no way to specify a key file.

I would apparently either need to copy alternative user keys to my ~/.ssh/ directory or setup another user on the system (which may not be needed for any other reason) and then log into such user.


Does a feature enhancement request need to be made or am I missing something?

Does anyone have further insight into this?


Thanks!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
various self-built desktop machines and a MiniForums U550 mini-PC
each runs LinuxMint 20.3 with Cinnamon
i7 self-built server --> Ubuntu 20.04.3 LTR (with Cinnamon, for the rare GUI login)
various VPSes --> Ubuntu Server LTR (headless)
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Nemo file manager connection to host using SSH with KEY

Post by smurphos »

I think you probably need to specify the paths to your your per host IdentityFiles in a manually created ~/.ssh/config or in /etc/ssh/ssh_config.d/some-file.conf

Have a look at the template config - /etc/ssh/ssh_config and consult man ssh_config
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
fbachofner
Level 3
Level 3
Posts: 101
Joined: Sun Aug 08, 2010 6:49 pm
Location: Seaside, CA

Re: Nemo file manager connection to host using SSH with KEY

Post by fbachofner »

Hi @smurphos
smurphos wrote: Sun Jan 23, 2022 3:59 am I think you probably need to specify the paths to your your per host IdentityFiles in a manually created ~/.ssh/config or in /etc/ssh/ssh_config.d/some-file.conf
Thanks for the suggestion. I will muck around with this.

The problem is that even if this works (a solid assumption given what I know can generally be accomplished with ssh config files), it would not allow for ad hoc connection changing between users.

I would be surprised to find that my desired functionality is an edge case.

I can imagine that IT consultants would want to login to the same host as different users just for the defacto ease of setting ownership/permissions for files transferred for particular users, for example.
various self-built desktop machines and a MiniForums U550 mini-PC
each runs LinuxMint 20.3 with Cinnamon
i7 self-built server --> Ubuntu 20.04.3 LTR (with Cinnamon, for the rare GUI login)
various VPSes --> Ubuntu Server LTR (headless)
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Nemo file manager connection to host using SSH with KEY

Post by smurphos »

Mmm, I'm not sure - my SSH use case is very straight forward - one host that I ssh into via the command line or mount the storage on the remote with SFTP (a little nemo script to mount/dismount the drive when I'm connecting from my main machine - its quicker and easier than using the dialog). However I'm pretty sure when you set up the config file your host listings can include both username and an identity key, so I guess for one physical host you can list multiple profiles with different user and identity files. I'm not sure how or if that works with nemo's dialog though...

I'm guessing IT admins would be more likely to be using the command line for those kind of activities, and then then would presumably SSH into a sudo enabled admin account or just root so they can act as any user on the host post logging in .... That's how I would do it anyway, and seems a lot simpler than maintaining a library of identity files.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Nemo file manager connection to host using SSH with KEY

Post by smurphos »

smurphos wrote: Tue Jan 25, 2022 3:49 amI'm not sure how or if that works with nemo's dialog though...
Ok should work - I've just set up a little test profile - same user but two different identity files (actually one is a copy of the the other)

Code: Select all

host default
  HostName 192.168.1.150
  User steve
  IdentityFile ~/.ssh/id_rsa
  

host test
  HostName 192.168.1.150
  User steve
  IdentityFile ~/.ssh/id_rsa1
In nemo's Connect to server dialog I just type default or test in the Server entry and hit connect - it works just fine. I see no reason why it wouldn't work with different users and different identity files.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
fbachofner
Level 3
Level 3
Posts: 101
Joined: Sun Aug 08, 2010 6:49 pm
Location: Seaside, CA

Re: Nemo file manager connection to host using SSH with KEY

Post by fbachofner »

smurphos wrote: Tue Jan 25, 2022 3:49 am I'm guessing IT admins would be more likely to be using the command line for those kind of activities, and then then would presumably SSH into a sudo enabled admin account or just root so they can act as any user on the host post logging in .... That's how I would do it anyway, and seems a lot simpler than maintaining a library of identity files.
Ad hoc visual (i.e. using Nemo or similar) file transfer as a specific user is often much quicker than using the text shell.

Not only is it easy to select multiple non-contiguous files, BUT you also generally do not then need to chown / chmod the file(s) to the user who will ultimately be using them as you are already "in" their account and pasting from an otherwise authorized source on the "outside."
various self-built desktop machines and a MiniForums U550 mini-PC
each runs LinuxMint 20.3 with Cinnamon
i7 self-built server --> Ubuntu 20.04.3 LTR (with Cinnamon, for the rare GUI login)
various VPSes --> Ubuntu Server LTR (headless)
fbachofner
Level 3
Level 3
Posts: 101
Joined: Sun Aug 08, 2010 6:49 pm
Location: Seaside, CA

Re: Nemo file manager connection to host using SSH with KEY

Post by fbachofner »

smurphos wrote: Tue Jan 25, 2022 4:03 am Ok should work - I've just set up a little test profile - same user but two different identity files (actually one is a copy of the the other)
Same user . . . not what I am after
In nemo's Connect to server dialog I just type default or test in the Server entry and hit connect - it works just fine. I see no reason why it wouldn't work with different users and different identity files.
OK, thinking about it, you are probably right. Different users should likely work. I'll try it out when I have a bit more free time.

I guess with well-chosen host names, this could work pretty well.

However, it necessitates an SSH config file. It would be great if Nemo could be updated to allow ad hoc connections along the line I am advocating.
various self-built desktop machines and a MiniForums U550 mini-PC
each runs LinuxMint 20.3 with Cinnamon
i7 self-built server --> Ubuntu 20.04.3 LTR (with Cinnamon, for the rare GUI login)
various VPSes --> Ubuntu Server LTR (headless)
Locked

Return to “Software & Applications”