LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   command usermod not found (https://www.linuxquestions.org/questions/linux-newbie-8/command-usermod-not-found-385901/)

bowie101 11-23-2005 02:10 PM

command usermod not found
 
says the command usermod not found (using Putty to connect with a Red Hat Enterprise Server) . in bash shell.

options?

Tinkster 11-23-2005 02:46 PM

You have to "su -" to root, the file is in /usr/sbin

bowie101 11-24-2005 03:25 AM

[root@firebird sbin]# usermod brian

bash: usermod: command not found

[root@firebird sbin]# usermod

bash: usermod: command not found

[root@firebird sbin]# emacs usermod

--------------------------------------------------------
^?ELF^A^A^A^@^@^@^@^@^@^@^@^@^B^@^C^@^A^@^@^@P\233^D^H4^@^@^@øæ^@^@^@^@^@^@4^@ \
^@^G^@(^@^X^@^W^@^F^@^@^@4^@^@^@4\200^D^H4\200^D^Hà^@^@^@à^@^@^@^E^@^@^@^D^@^@^\
@^C^@^@^@^T^A^@^@^T\201^D^H^T\201^D^H^S^@^@^@^S^@^@^@^D^@^@^@^A^@^@^@^A^@^@^@^@\
^@^@^@^@\200^D^H^ ...etc
------------------------------------------------------------

what am i doing wrong here?

twantrd 11-24-2005 03:44 AM

'usermod' might not be in your path. Try the full path instead.

-twantrd

titopoquito 11-24-2005 08:13 AM

Quote:

Originally posted by Tinkster
You have to "su -" to root, the file is in /usr/sbin
You have to read more carefully. The quote solves your problem completely. Trust Tinkster :)

You have two choices:
1) the program you want to start is included in your path
2) you start the program giving the full path

ad 1) Starting su with the option " -" gives you the full path root would have when logging in to the system after startup. So directories like /usr/sbin, /sbin or /opt/kde/bin become part of roots path variable after doing su and will be searched for commands.
ad 2) the other possibility is to start /usr/sbin/usermod (giving the full path) or doing ./usermod in the /usr/sbin directory (giving relative path)

bowie101 11-25-2005 05:38 AM

ok, I'll get to this today. thank you!

8day 05-29-2020 06:52 PM

The correct way to handle it.
 
# I wrote a simple bash script if this should work
#!/bin/bash
if [ -e /usr/sbin/usermod ];
then
echo "Found the file"
cp /usr/sbin/usermod /usr/bin/usermod
echo "Done, now try to type the command"
else
echo "File not found, try to download the binary somewhere or download the required package"
fi

scasey 05-29-2020 07:40 PM

8day, Welcome to LQ.
Posting to 15 year old threads is generally frowned on, although you did submit one solution to the problem. Unfortunately, it assumes that it knows the location of the file to begin with.

Personally, I’d have tried the find command or the locate command (see the man pages) — or I’d have asked the OP to post their $PATH so we could see if the problem was there.

rtoledo 08-16-2021 01:37 PM

old but still good info
 
thank you Tinkstor and titopoquito for pointing out a small detail

chrism01 08-17-2021 12:33 AM

Re post #7 : don't do that.
Either add it your path or just use full absolute path...

jpollard 08-17-2021 10:24 AM

Quote:

Originally Posted by 8day (Post 6128877)
# I wrote a simple bash script if this should work
#!/bin/bash
if [ -e /usr/sbin/usermod ];
then
echo "Found the file"
cp /usr/sbin/usermod /usr/bin/usermod
echo "Done, now try to type the command"
else
echo "File not found, try to download the binary somewhere or download the required package"
fi

That should never be done. If the file is there, then it is there. Copying it to /usr/bin won't change anything - except violate one of the security protections (minor, but still).

As well as break any updates the distribution may apply.

rtoledo 08-17-2021 07:10 PM

it worked for me
 
I just want to say , that when i loged in as su , it gave me the same error. after I read the posts above and did the su - log in again , this time the path to usermod and other things like adding my user account to sudoers all worked.

keep in mind that some us re-new users just want it to work and eventhough I have been using Linux on&off since it was a fraction and I was using those old GOLD cd's to download it to.

anyways count me as a Windows dude , that uses Linux when it's needed. and very happy with Bullseye . just testing HAM RADIO stuff

thanks again for the info

chrism01 08-18-2021 01:26 AM

FYI, 'su <user>' means login as target user (default = root) BUT keep original user's env, inc $PATH, which is why it didn't work.

'su - <user>' means login as target user (default = root) AND gain target's env (eg $PATH etc) as well .....


All times are GMT -5. The time now is 08:29 AM.