Solved

Create ssh root password

Posted on 2014-07-22
11
344 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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
 

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 29

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 29

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I access my AWS instance folders & files using SSH? 1 58
Linux hostname change 2 83
android secure ftp 3 50
ftp to port 21 4 53
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…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

840 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