LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-14-2012, 05:05 PM   #1
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Rep: Reputation: Disabled
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

Last edited by sanaz; 09-14-2012 at 05:23 PM.
 
Old 09-14-2012, 05:40 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,353
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
That's not a problem but exactly like it should be.
 
Old 09-14-2012, 05:41 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,788

Rep: Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162
Quote:
Originally Posted by sanaz View Post
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.
 
Old 09-14-2012, 05:42 PM   #4
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,977
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Quote:
Originally Posted by sanaz View Post
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
 
Old 09-17-2012, 08:10 AM   #5
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by custangro View Post
You need to enable SSH as root in your ssh config file.

--C

Thanks every one. Can you explain how>
 
Old 09-17-2012, 10:54 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,788

Rep: Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162Reputation: 4162
Quote:
Originally Posted by sanaz View Post
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.
 
Old 09-17-2012, 11:20 AM   #7
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,500

Rep: Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636
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
 
1 members found this post helpful.
Old 09-18-2012, 11:36 AM   #8
sanaz
Member
 
Registered: Aug 2012
Posts: 76

Original Poster
Rep: Reputation: Disabled
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 View Post
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

Last edited by sanaz; 09-18-2012 at 11:54 AM.
 
  


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
root terminal has different bash config when I ssh in vs su from another ssh account stardotstar Linux - General 4 07-01-2010 06:24 PM
Stange problem with root login on ssh nekkro-kvlt Linux - Software 7 10-24-2009 05:27 AM
Chroot SSH problem: ssh working, not SFTP & SCP. NaCo Linux - Security 3 02-01-2009 02:23 AM
SSH access problems: Can only allow users SSH access by adding to root group dhupke Slackware 10 12-21-2008 09:48 AM
I have to ssh -l root to run root processes!? paul.nel Red Hat 3 11-15-2004 11:55 AM


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

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration