Solved

Create ssh root password

Posted on 2014-07-22
11
340 Views
Last Modified: 2014-08-04
For some reason, after a plesk update, I can no longer login to ssh as root using my old password. I have tried to create a user with:

   
/bin/bash & /bin/bash (chrooted) in plesk

Which lets me login but has no root privileges. How can I either recover my old password or get access to the ssh config to check whether root login is disabled. I installed ssh term in plesk, but that bums out with an error of:

 
 jarsigning exception

Guess it's because there is only the default certificate on the server. I would be grateful if someone could help with this as I have reached a point where I am struggling to find other things to try. Many thanks

Plesk 11.5 CentOS 6 SSH Client
0
Comment
Question by:peter-cooper
  • 5
  • 4
  • 2
11 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 40211154
Can you boot the system to single user mode / maintenance mode? IF you can then you should have root access and then you can check or change password.
0
 

Author Comment

by:peter-cooper
ID: 40211171
I cannot see a way to do that in plesk. Thanks
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 40211288
To do so, you need to be physically near the server console.
0
 

Author Comment

by:peter-cooper
ID: 40212130
Well I have managed to recover the server but i still cannot login or sun as root. I get the following error:

su: using restricted shell /bin/bash
: No such file or directory

According to parrells this is caused by malformed etc/passwd file. And I quote.

Correct example:

# cat /etc/passwd | grep ^root | hexdump -c
0000000   r   o   o   t   :   x   :   0   :   0   :   r   o   o   t   :
0000010   /   r   o   o   t   :   /   b   i   n   /   b   a   s   h  \n
0000020

Incorrect example (file was edited in Windows):

# cat /etc/passwd | grep ^root | hexdump -c
0000000   r   o   o   t   :   x   :   0   :   0   :   r   o   o   t   :
0000010   /   r   o   o   t   :   /   b   i   n   /   b   a   s   h  \r
0000020  \n
0000021
The file in my domain etc/passwd shows the incorrect data as above. I cannot get to the root etc/passwd to check. How can I edit to remove the extra character? Thanks
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 40212190
Can you use vi to edit /etc/passwd ?

If yes, then when you run

vi /etc/passwd

and while in command mode in vi, type

:1,$ s/^V^M//g
:wq

In the above ^V^M is cntrl+V cntrl+M (control key and control M)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:peter-cooper
ID: 40216479
Thank you for your comments. However, 2 things. 1st, The file appears to be in read mode and 2, I get pattern not found. What am I doing wrong. Thanks
0
 
LVL 28

Expert Comment

by:serialband
ID: 40218426
In VMWare and in VirtualBox, you can boot from a Linux Live ISO and then mount the root disk to fix the files.  Can you do that in Plesk?  You need to be root to edit /etc/passwd.  It's likely in read mode because you're not root.
0
 

Author Comment

by:peter-cooper
ID: 40218988
@serial I have already done that but still the same problem. I am totally up a tree with this. Thanks
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 40220462
can you post the /etc/passwd content?
0
 
LVL 28

Accepted Solution

by:
serialband earned 500 total points
ID: 40220585
If /etc/passwd exists, you may want to clear it and update it with your newly created accounts and passwords.

   mkpasswd -l > /etc/passwd
   mkgroup -l > /etc/group

You can also rename it in case you have something there that you want to save.
   mv /etc/passwd /etc/passwd2


Here's a link that might help you. http://pic.dhe.ibm.com/infocenter/dstudio/v3r2/topic/com.ibm.datatools.base.install.doc/topics/t_dsa_configurelcygwin.html
0
 

Author Closing Comment

by:peter-cooper
ID: 40239732
Thank you. Still struggling with this, but may have to re-image the server.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
nodeip 9 75
aix tls version 6 224
building a service to accessed via telnet client, want colors ? 4 83
check unix curl command return value 7 84
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now