command usermod not found
says the command usermod not found (using Putty to connect with a Red Hat Enterprise Server) . in bash shell.
options? |
You have to "su -" to root, the file is in /usr/sbin
|
[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? |
'usermod' might not be in your path. Try the full path instead.
-twantrd |
Quote:
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) |
ok, I'll get to this today. thank you!
|
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 |
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. |
old but still good info
thank you Tinkstor and titopoquito for pointing out a small detail
|
Re post #7 : don't do that.
Either add it your path or just use full absolute path... |
Quote:
As well as break any updates the distribution may apply. |
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 |
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. |