LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problem in ssh as root (https://www.linuxquestions.org/questions/linux-newbie-8/problem-in-ssh-as-root-4175427315/)

sanaz 09-14-2012 05:05 PM

problem in ssh as root
 
Hi all

I'm trying to ssh to a host

when I'm trying to ssh as regular user and then become root I have no problem:

Code:

$ssh -X host
[myusername@host ~]$ sudo -s
[root@host myusername]#

but when I'm trying to ssh as root, this is what's happening:
Code:

$ssh -X root@HOST
root@HOST's password:
Permission denied, please try again.
root@HOST's password:
Permission denied, please try again.
root@HOST's password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

Any help is really appreciated

unSpawn 09-14-2012 05:40 PM

That's not a problem but exactly like it should be.

TB0ne 09-14-2012 05:41 PM

Quote:

Originally Posted by sanaz (Post 4780634)
Hi all
I'm trying to ssh to a host when I'm trying to ssh as regular user and then become root I have no problem:
Code:

$ssh -X host
[myusername@host ~]$ sudo -s
[root@host myusername]#

but when I'm trying to ssh as root, this is what's happening:
Code:

$ssh -X root@HOST
root@HOST's password:
Permission denied, please try again.
root@HOST's password:
Permission denied, please try again.
root@HOST's password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

Any help is really appreciated

There's nothing to help WITH. By default, logging in as root is disabled, and for good reason. You shouldn't EVER log in as root over the network. If you think you must...you don't, since (and you said it yourself), you're able to log in as a 'regular' user, then SUDO. If you want to, then read the man page on sshd_config, and pay particular attention to the PermitRootLogin directive.

custangro 09-14-2012 05:42 PM

Quote:

Originally Posted by sanaz (Post 4780634)
Hi all

I'm trying to ssh to a host

when I'm trying to ssh as regular user and then become root I have no problem:

Code:

$ssh -X host
[myusername@host ~]$ sudo -s
[root@host myusername]#

but when I'm trying to ssh as root, this is what's happening:
Code:

$ssh -X root@HOST
root@HOST's password:
Permission denied, please try again.
root@HOST's password:
Permission denied, please try again.
root@HOST's password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

Any help is really appreciated

You need to enable SSH as root in your ssh config file.

--C

sanaz 09-17-2012 08:10 AM

Quote:

Originally Posted by custangro (Post 4780648)
You need to enable SSH as root in your ssh config file.

--C


Thanks every one. Can you explain how>

TB0ne 09-17-2012 10:54 AM

Quote:

Originally Posted by sanaz (Post 4782258)
Thanks every one. Can you explain how>

I told you how in post #3, and even told you the directive to change. The config file is, again, sshd_config.

jlinkels 09-17-2012 11:20 AM

Don't allow root access over SSH. It is disabled for a reason.

And I don't see the need for opening an -X tunnel as root. It is not necessary, unless intend to run X applications as root. A bad idea, and if you have to, you can use gksudo from the command line IIRC.

jlinkels

sanaz 09-18-2012 11:36 AM

This is exactly what I want to do, ssh as root and run X applications. But because I cannot I always get error:
Code:

# virt-manager
X11 connection rejected because of wrong authentication.
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager.py", line 386, in <module>
    main()
  File "/usr/share/virt-manager/virt-manager.py", line 287, in main
    raise gtk_error
RuntimeError: could not open display

or

Code:

# xterm
X11 connection rejected because of wrong authentication.
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can't open display: %s

or

Code:

# startx
xauth:  file /root/.serverauth.12897 does not exist
xauth:  file /root/.Xauthority does not exist
xauth:  file /root/.Xauthority does not exist


X.Org X Server 1.12.3
Release Date: 2012-07-09
X Protocol Version 11, Revision 0
Build Operating System:  2.6.32-279.2.1.el6.x86_64
Current Operating System: Linux 3.5.3-1.fc17.x86_64 #1 SMP Wed Aug 29 18:46:34 UTC 2012 x86_64
Kernel command line: BOOT_IMAGE=/vmlinuz-3.5.3-1.fc17.x86_64 root=/dev/mapper/vg1-lv1 ro rd.md=0 rd.dm=0 rd.lvm.lv=vg1/lv3 rd.lvm.lv=vg1/lv1 KEYTABLE=us printk.time=0 rd.luks=0 SYSFONT=True LANG=en_US.UTF-8 rhgb quiet
Build Date: 20 August 2012  02:12:31AM
Build ID: xorg-x11-server 1.12.3-1.fc17
Current version of pixman: 0.24.4
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri Sep 14 12:43:52 2012
(==) Using system config directory "/usr/share/X11/xorg.conf.d"

Fatal server error:
no screens found

Please consult the Fedora Project support
        at http://wiki.x.org
 for help.
Please also check the log file at "/var/log/Xorg.0.log" for additional information.

Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
xauth:  timeout in locking authority file /home/myusername/.Xauthority


Quote:

Originally Posted by jlinkels (Post 4782407)
Don't allow root access over SSH. It is disabled for a reason.

And I don't see the need for opening an -X tunnel as root. It is not necessary, unless intend to run X applications as root. A bad idea, and if you have to, you can use gksudo from the command line IIRC.

jlinkels



All times are GMT -5. The time now is 08:11 PM.