LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 06-14-2019, 10:18 AM   #1
sim0
LQ Newbie
 
Registered: Jun 2019
Posts: 5

Rep: Reputation: Disabled
Exclamation deleted /usr/bin/passwd by accident


hi ,
as i mentioned in title i delete '/usr/bin/passwd' by accident on my CentOS Linux release 7.2.1511 (Core).. please help, the easy way i see is if anyone have the same Centos 7 uploads the /usr/bin/passwd.
thanks
 
Old 06-14-2019, 10:20 AM   #2
sevendogsbsd
Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 923

Rep: Reputation: Disabled
Oops, totally misread this as "etc/passwd", my bad...

Last edited by sevendogsbsd; 06-14-2019 at 10:33 AM.
 
Old 06-14-2019, 10:30 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,442

Rep: Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627
Quote:
Originally Posted by sim0 View Post
hi ,
as i mentioned in title i delete '/usr/bin/passwd' by accident on my CentOS Linux release 7.2.1511 (Core).. please help, the easy way i see is if anyone have the same Centos 7 uploads the /usr/bin/passwd.
thanks
Put in your installation media, and copy it from there. The /usr/bin/passwd program is a binary, and since you have the installation media (or can easily make one), you can just copy that program back.
 
Old 06-14-2019, 01:45 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,709
Blog Entries: 15

Rep: Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599
/usr/bin/passwd is part of the "passwd" RPM. You could just reinstall that package:

Code:
yum reinstall passwd
 
1 members found this post helpful.
Old 06-14-2019, 04:38 PM   #5
sim0
LQ Newbie
 
Registered: Jun 2019
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by MensaWater View Post
/usr/bin/passwd is part of the "passwd" RPM. You could just reinstall that package:

Code:
yum reinstall passwd
You need to be root to perform this command... i don't have root account on the server

Last edited by sim0; 06-15-2019 at 12:16 AM.
 
Old 06-15-2019, 07:37 AM   #6
sevendogsbsd
Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 923

Rep: Reputation: Disabled
Then how did you delete /usr/bin/passwd? A standard user does not have permissions to delete a binary in that directory.
 
2 members found this post helpful.
Old 06-15-2019, 01:30 PM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,442

Rep: Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627Reputation: 5627
Quote:
Originally Posted by sim0 View Post
You need to be root to perform this command... i don't have root account on the server
As sevendogsbsd pointed out, you couldn't have done what you say you did, without root (or sudo/root-level) access. And even past that, you can simply power the system off, and boot in single-user mode (which IS root-enabled), mount the hard drive and install media manually, and copy the file.

Or copy the file using sudo.
 
Old 06-15-2019, 02:49 PM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 11,626
Blog Entries: 9

Rep: Reputation: 3077Reputation: 3077Reputation: 3077Reputation: 3077Reputation: 3077Reputation: 3077Reputation: 3077Reputation: 3077Reputation: 3077Reputation: 3077Reputation: 3077
Quote:
Originally Posted by sevendogsbsd View Post
Oops, totally misread this as "etc/passwd", my bad...
That's probably what happened to OP, too.

But how, without superuser privileges?
 
Old Yesterday, 09:33 AM   #9
sim0
LQ Newbie
 
Registered: Jun 2019
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sevendogsbsd View Post
Then how did you delete /usr/bin/passwd? A standard user does not have permissions to delete a binary in that directory.
i have the permission to copy or move or delete /usr/bin/passwd without root or sudo... maybe a misconfiguration behind that
 
Old Yesterday, 09:35 AM   #10
sim0
LQ Newbie
 
Registered: Jun 2019
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
That's probably what happened to OP, too.

But how, without superuser privileges?
misconfiguration.. maybe!!
 
Old Yesterday, 09:40 AM   #11
sim0
LQ Newbie
 
Registered: Jun 2019
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
As sevendogsbsd pointed out, you couldn't have done what you say you did, without root (or sudo/root-level) access. And even past that, you can simply power the system off, and boot in single-user mode (which IS root-enabled), mount the hard drive and install media manually, and copy the file.

Or copy the file using sudo.
as i say i don't have physical access to the server it's in on the other side of the earth.. thanks for the response
 
Old Yesterday, 10:02 AM   #12
sevendogsbsd
Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 923

Rep: Reputation: Disabled
Quote:
Originally Posted by sim0 View Post
i have the permission to copy or move or delete /usr/bin/passwd without root or sudo... maybe a misconfiguration behind that
Definitely a misconfiguration. So can you copy INTO /usr/bin? If you can, SSH into the server and mount installation medium locally, then copy the file from your local machine out to the server into /usr/bin with rsync or some other remote command.

After you get the system working, you need to reconfigure so you can use sudo.
 
Old Yesterday, 10:53 AM   #13
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 12,682

Rep: Reputation: 3977Reputation: 3977Reputation: 3977Reputation: 3977Reputation: 3977Reputation: 3977Reputation: 3977Reputation: 3977Reputation: 3977Reputation: 3977Reputation: 3977
additionally you can download the mentioned rpm, unpack it and use the binary from that package.
 
1 members found this post helpful.
Old Yesterday, 11:49 AM   #14
sevendogsbsd
Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 923

Rep: Reputation: Disabled
Probably could also SSH into the remote machine and use wget to download the rpm and install from there, if you have internet access - many ways to do this.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Cannot find 'ssh-keygen' in '/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin' venu.navat Linux - Software 3 03-08-2012 04:00 AM
Deleted /usr/lib by accident molossus Fedora 1 12-28-2010 06:23 PM
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 08:33 AM
Just deleted /usr/lib/pkgconfig by accident. Hunter2 Slackware 3 06-25-2006 07:15 PM
chsh accident; big accident. shinystuffrox *BSD 3 06-06-2005 07:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 01:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration