Solved

Create ssh root password

Posted on 2014-07-22
11
338 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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 27

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 27

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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.:
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…

758 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

19 Experts available now in Live!

Get 1:1 Help Now