LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-23-2005, 02:10 PM   #1
bowie101
Member
 
Registered: Nov 2005
Distribution: FC4 & RHES
Posts: 105

Rep: Reputation: 15
command usermod not found


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

options?
 
Old 11-23-2005, 02:46 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
You have to "su -" to root, the file is in /usr/sbin
 
Old 11-24-2005, 03:25 AM   #3
bowie101
Member
 
Registered: Nov 2005
Distribution: FC4 & RHES
Posts: 105

Original Poster
Rep: Reputation: 15
[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?
 
Old 11-24-2005, 03:44 AM   #4
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
'usermod' might not be in your path. Try the full path instead.

-twantrd
 
Old 11-24-2005, 08:13 AM   #5
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,646

Rep: Reputation: 146Reputation: 146
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)
 
Old 11-25-2005, 05:38 AM   #6
bowie101
Member
 
Registered: Nov 2005
Distribution: FC4 & RHES
Posts: 105

Original Poster
Rep: Reputation: 15
ok, I'll get to this today. thank you!
 
Old 05-29-2020, 06:52 PM   #7
8day
LQ Newbie
 
Registered: May 2020
Posts: 1

Rep: Reputation: Disabled
Red face 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
 
Old 05-29-2020, 07:40 PM   #8
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
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.
 
1 members found this post helpful.
Old 08-16-2021, 01:37 PM   #9
rtoledo
LQ Newbie
 
Registered: Jun 2004
Posts: 4

Rep: Reputation: 0
Talking old but still good info

thank you Tinkstor and titopoquito for pointing out a small detail
 
Old 08-17-2021, 12:33 AM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Re post #7 : don't do that.
Either add it your path or just use full absolute path...
 
Old 08-17-2021, 10:24 AM   #11
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by 8day View Post
# 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.
 
Old 08-17-2021, 07:10 PM   #12
rtoledo
LQ Newbie
 
Registered: Jun 2004
Posts: 4

Rep: Reputation: 0
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
 
Old 08-18-2021, 01:26 AM   #13
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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 .....
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash: <command name> command not found smash Programming 5 03-13-2006 08:48 AM
usermod and groupadd meDream Linux - Newbie 0 10-05-2005 05:01 AM
usermod / useradd ? bibilit Linux - Software 1 12-19-2003 02:16 AM
usermod shanenin Linux - Software 4 12-08-2003 08:49 AM
usermod thelight1 Linux - Newbie 1 07-24-2003 12:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:15 PM.

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
Open Source Consulting | Domain Registration