CentOSThis forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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.
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
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.
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.
additionally you can download the mentioned rpm, unpack it and use the binary from that package.
To do this on CentOS:
1) Make yourself a subdirectory for the download and extract that follows:
Code:
mkdir passwd
2) Change to the new subdirectory:
Code:
cd passwd
3) Download the RPM:
Code:
yumdownloader passwd
4) Above should put a file like passwd-0.79-4.el7.x86_64.rpm in the directory. RPMs can be converted to cpio backup format (similar to tar format) with the rpm2cpio command. That cpio output can be extracted with the cpio command so the following pipeline does the conversion to cpio and the extract of the files the RPM contained:
5) That will install the files in subdirectories of the one you created so your new passwd subdirectroy will contain ./usr/bin/passwd (the . is important). You can copy that into the real /usr/bin:
Code:
cp -p ./usr/bin/passwd /usr/bin/passwd
Note:
You may need to prepend the "cp" with "sudo" or some other command as regular users don't have permission to write into /usr/bin but you seem to indicate you do.
Last edited by MensaWater; 06-17-2019 at 08:49 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.