- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: useradd
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2001 02:16 PM
11-19-2001 02:16 PM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2001 02:24 PM
11-19-2001 02:24 PM
Re: useradd
You can try to specify the uid with:
useradd -u 1001 newuser
That will create a new user called "newuser" with uid=1001
Regards,
Paga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2001 02:25 PM
11-19-2001 02:25 PM
Re: useradd
# usradd -u uid ...
...specifies the uid of the new user.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2001 02:26 PM
11-19-2001 02:26 PM
Re: useradd
Just saw the example and I thought I would throw in my two cents.
C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2001 02:28 PM
11-19-2001 02:28 PM
Re: useradd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2001 02:33 PM
11-19-2001 02:33 PM
Re: useradd
useradd -u $MAX . . .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2001 02:37 PM
11-19-2001 02:37 PM
SolutionIn this case, rename useradd to useradd.original (or even better, take it out of samba's PATH) and add a script called "useradd" like that:
#/bin/sh
lastuid=`cat /etc/passwd | awk 'BEGIN {FS=":"} ($3 < 65000) { print $3 }'| sort -n| tail -1`
useradd.original -u $lastuid $*
That should do the trick for you.
Regards,
Paga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2001 02:41 PM
11-19-2001 02:41 PM
Re: useradd
It will be difficult to assign user id's 1000+ by default. There is no file in which the default is stored. you have to specify the userid manually if you want to set them to 1000+.
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2001 02:46 PM
11-19-2001 02:46 PM
Re: useradd
useradd will assign the next free user id above 100. So if you have removed a user with uid 102 useradd will default to use that uid.
If after this you add a user and all uids are in use up to 200 useradd will default to 201.
If you really need to use 1001 you can use
useradd -u 1001 newuser.
Hope this helps
R.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2001 05:54 PM
11-19-2001 05:54 PM
Re: useradd
I like your idea of the script but could not get it to run when called from samba. Didn't look like it was running. I have all permissions set correctly but will have to look at it more tomorrow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2001 06:05 PM
11-19-2001 06:05 PM
Re: useradd
Things to verify:
1) make sure the script is in the PATH! (you can put it in the same place as useradd for testing purposes. If it can run from there you can later move it to a place where only samba will find it.
2) Make sure it's chmod 755
3) Make sure useradd.original can be found by the script
Let me know what happens (the script runs but doesn't work, etc). Also, you can add
echo [$*] >>/tmp/temp.log
as the second line in the script (right after /bin/sh) This will create an output in /tmp/temp.log with the arguments passed to 'useradd'.
Hope it helps.
Regards,
Paga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2001 08:27 AM
11-20-2001 08:27 AM
Re: useradd
#!/bin/sh
lastuid=`cat /etc/passwd | awk 'BEGIN {FS=":"} ($3 < 65000) { print $3 }'| sort -n| tail -1`
((lastuid = lastuid +1))
useradd -u $lastuid $*
Call script as so ... useradd.script username
It searches the passwd file, returns the highest uid value and then adds user to /etc/passwd file.
thanks to Alan and Marco for their assistance