LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-13-2005, 11:51 PM   #1
Cottsay
Member
 
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195

Rep: Reputation: 31
SSH with root


I run Fedora Core 3 with SELinux passive, and I am trying to do an RSA key SSH to root. (I know, I know - bad idea) - reason being I need to perform commands in PHP as root, which can't be done without SSHing to root in one command blah blah blah...anywho...I can easily authenticate any other user on the system...cept root. I had it working at one time...then it died - I think it could have something to do with the /etc/hosts file being modified. I don't know...any ideas?
 
Old 09-14-2005, 12:05 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
I don't know if this will help but it just might.

If you change the hostname or make other changes, attempts to ssh into that machine may fail with a spooky message along the lines of somebody may be doing something bad....

You can get a fresh start by removing the hidden .ssh file in the users home directory ( root in this case ) .
 
Old 09-14-2005, 01:48 AM   #3
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
Check the PermitRootLogin setting in your sshd config file (/etc/ssh/sshd_config in Mandriva)
 
Old 09-14-2005, 02:47 AM   #4
fatal_boot
LQ Newbie
 
Registered: Sep 2005
Location: Toowoomba, QLD, AU
Distribution: SuSE, Mandrake, Slackware, Debian, Ubuntu, Fedora, IPCop, Smoothwall etc
Posts: 7

Rep: Reputation: 0
Why not login as a limited user and su in as root?

The problem you facing is that by default, the option to login as root is disabled.
 
Old 09-14-2005, 06:21 AM   #5
vireshwali
Member
 
Registered: Sep 2005
Posts: 67

Rep: Reputation: 15
well there can be any of the following reasons. check each one thoroughly.

1> ssh on remote server doesn't allow direct root logins.
check the /etc/ssh/sshd_config on remote box and see if PermitRootLogin is set to YES(allow) or NO(disallow).

2> if possibly the ip or hostname of remote server has changed the you need to remove the line corresponding to the old ip or hostname in ur ~/.ssh/known_hosts file ,save it and then do a fresh ssh to the remote box.

3> analyse your network traffic using tethereal for some potential traffic sniffer and the port and shut down the service on that port.

hope this helps
 
Old 09-14-2005, 06:43 AM   #6
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
reason being I need to perform commands in PHP as root, which can't be done without SSHing to root in one command blah blah blah...
May I strongly suggest that you investigate sudo, which would allow your PHP script to run the commands specified by you with root permissions. Without having to log in as root. You can even set it up to not require a password.
 
Old 09-14-2005, 06:52 AM   #7
vireshwali
Member
 
Registered: Sep 2005
Posts: 67

Rep: Reputation: 15
sudo is also a good option.
but for that matter you can also configure raw ssh not to prompt you for login.
this needs you to generate a public key and a private key using sshkeygen and post the public key to remote box and place private key on ur box.
This is precisely what i do in my automated php and perl scripts that run through cron.

do let me klnow if you need details.
 
Old 09-15-2005, 11:30 PM   #8
Cottsay
Member
 
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195

Original Poster
Rep: Reputation: 31
Talking

Quote:
Check the PermitRootLogin setting in your sshd config file
That did it. Easier than I thought - even though I could still login using the password, I couldn't login using RSA without this set. Thanx!
 
Old 01-17-2006, 02:53 AM   #9
grant-skywalker
Member
 
Registered: Jul 2005
Location: Jakarta / Kuala Lumpur
Distribution: Slackware, Debian, Ubuntu, Centos
Posts: 40

Rep: Reputation: 15
Quote:
Originally Posted by vireshwali
sudo is also a good option.
but for that matter you can also configure raw ssh not to prompt you for login.
this needs you to generate a public key and a private key using sshkeygen and post the public key to remote box and place private key on ur box.
This is precisely what i do in my automated php and perl scripts that run through cron.

do let me klnow if you need details.
Hi vireshwali,

Browse through this post, if you don't mind to share in detail the steps needed??

regards,
Grant
 
Old 01-17-2006, 03:04 AM   #10
vireshwali
Member
 
Registered: Sep 2005
Posts: 67

Rep: Reputation: 15
Hi Grant,
are you intrested in knowing how can you bypass the password prompt when using ssh or scp?
 
Old 01-17-2006, 07:38 PM   #11
grant-skywalker
Member
 
Registered: Jul 2005
Location: Jakarta / Kuala Lumpur
Distribution: Slackware, Debian, Ubuntu, Centos
Posts: 40

Rep: Reputation: 15
Quote:
Originally Posted by vireshwali
Hi Grant,
are you intrested in knowing how can you bypass the password prompt when using ssh or scp?
Hi vireshwali,

Yes please!!
 
Old 01-18-2006, 01:42 AM   #12
vireshwali
Member
 
Registered: Sep 2005
Posts: 67

Rep: Reputation: 15
hi,
the trick here is to crack ssh well before it goes into keyboard interactive mode.
try ssh -v root@hostname and see the output. We need to crack it when it is trying at a public/private key match.

this url should get you going.
http://ad.hominem.org/log/2004/04/using_ssh_witho.php

alternatively search google for "ssh without password".

do let me know if you get hung up.
 
Old 01-18-2006, 05:11 PM   #13
Cottsay
Member
 
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195

Original Poster
Rep: Reputation: 31
Yea - thats what did it for me - the first thing is that you need to have to setting in your SSH conf file...
Quote:
Check the PermitRootLogin setting in your sshd config file (/etc/ssh/sshd_config in Mandriva)
...then you need to setup the keys...
Quote:
this url should get you going.
http://ad.hominem.org/log/2004/04/using_ssh_witho.php
...that did it for me
 
  


Reply



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
Only can ssh as root in FC 3 aetherane Fedora 8 01-25-2005 08:48 PM
I have to ssh -l root to run root processes!? paul.nel Red Hat 3 11-15-2004 11:55 AM
root using ssh juanb Linux - Security 1 08-05-2004 05:49 AM
SSH as root? DasVenn Solaris / OpenSolaris 4 04-25-2004 12:48 AM
Document root on SSH kidestranged Linux - Software 1 01-22-2004 07:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:01 AM.

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
Open Source Consulting | Domain Registration