Solved

Create ssh root password

Posted on 2014-07-22
11
359 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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 30

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 30

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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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

636 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