Re: question

From: Chuck (skilover_nospam_at_softhome.net)
Date: 02/25/05


Date: Fri, 25 Feb 2005 14:05:54 -0500

Dale Bohl wrote:
> Please help,
>
> Is it possible to run ssh as root but use another users
> login? For example:
>
> root# ssh user@hostname
>
> I'm running OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003 on RH Fedora Core3
> to OpenSSH_3.6.1p1, SSH protocols 1.5/2.0, OpenSSL 0x009060af
> on IRIX.
>
> I've created the rsa keys as the user on the system I'm sshing
> from and moved the key to the remote system in the user's account
> .ssh/authorized_keys file but I still get propmpted for a password.
>
> The reason I ask is I'm trying to do an rsync pull as root
> but use a differnt user so that the directory heiarchy is
> created on the local system as root.
>

I'm not sure I understand which user you created the ssh keys as. If you
are ssh'ing from root, you need to create them as root, then append the
public key (id_rsa.pub) to the authorized_keys file on the remote system
 in the remote user's $HOME/.ssh directory.

For example if you are logged in locally as root, and want to connect
remotely as bilbo...

local#root$ ssh-keygen -t rsa -b 2048
local#root# scp ~/.ssh/id_rsa.pub bilbo@remote:.ssh/root.pub

You'll need to enter a password to get the public key over to "remote".

remote#bilbo$ cd ~/.ssh
remote#bilbo$ cat root.pub >> authorized_keys
remote#bilbo$ rm root.pub

Now you should be able to ssh and scp from "local" to "remote" without
entering a password. You will however need to enter a *passphrase* on
local unless you either generated the private key without a passphrase
(bad idea IMHO) or use ssh-agent/ssh-add to cache the key for you.



Relevant Pages

  • Re: PermitRootLogin=yes versus su
    ... > a regular user and using su to become root. ... > Back in the days before strong encryption, when remote access was done ... > However, we now have SSH. ...
    (comp.security.ssh)
  • Reasoning behind a default remote root login ?
    ... using ssh. ... remote root logins alltogether. ... Does anyone know why OpenBSD allows remote root ...
    (comp.unix.bsd.openbsd.misc)
  • PermitRootLogin=yes versus su
    ... a regular user and using su to become root. ... Back in the days before strong encryption, when remote access was done ... However, we now have SSH. ... Logging in as a regular user via SSH, then using su to become root, ...
    (comp.security.ssh)
  • Re: Restricting access to a web server by IP
    ... > remote control clients, etc - we remotely ... > The agrument against is that mpst vulnerabilities seem to come through ... > servers, and blocking access to all IPs accept those on the allowed list - ...
    (comp.security.misc)
  • Re: Restricting access to a web server by IP
    ... > remote control clients, etc - we remotely ... > The agrument against is that mpst vulnerabilities seem to come through ... > servers, and blocking access to all IPs accept those on the allowed list - ...
    (comp.security.firewalls)