Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Create ssh root password

Posted on 2014-07-22
11
Medium Priority
?
376 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 31

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 31

Accepted Solution

by:
serialband earned 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
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…
Suggested Courses
Course of the Month6 days, 8 hours left to enroll

782 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