I tried using grep to do so, but it got really out of hand lol
I think you got offered a better solution here, but in case your curiosity is still aroused, this is how grep/cut can do it:
grep's task is to select all lines where UID is below 100. I have no Solaris system at hand, so here is a passwd from an AIX system. The ideas how to filter are the same, though.
First, what is "lower than/greater than 100" in regexps? Below 100:
This covers every number with one or two digits 0-9, therefore "0-99". We can use "grep -v" to invert that regexp and get evrything greater/equal. Because this is the third field and is delimited by ":" we add these to the regexp to further reduce ambiguity:
Now, because we want this to only match the third field, not any other, what is the "third field" here? It is: some characters, followed by a colon, followed by some more characters, followed by a colon - and now any character up to the next colon. In regexp:
Now try it:
I hope this helps.
bakunin
These 2 Users Gave Thanks to bakunin For This Post:
I'm afraid that [0-9]*[0-9] will match any integer number, even longer than two digits. Try [0-9]?[0-9] instead. You may need to escape the quotation mark or use extended grep.
Hello,
I've just started using a Solaris machine with SunOS 5.10.
After the machine is turned on, I open a Console window and at the prompt, if I execute a pwd command, it tells me I'm at my home directory (someone configured "myuser" as default user after init).
... (2 Replies)
I am trying to create Oracle user. I will install oracle after that. But my problem is /home/oracle directory is not being created.
bash-3.2# useradd -g oinstall -G dba,oper -d /home/oracle -m oracle
cp: /home/oracle: Operation not applicable
chown: /home/oracle: No such file or directory
... (3 Replies)
Hi,
I've created solaris user which has both FTP and SFTP Access. Using the "ftpaccess" configuration file options "guest-root" and "restricted-uid", i can restrict the user to a specific directory. But I'm unable to restrict the user when the user is logged in using SFTP.
The aim is to... (1 Reply)
Hi all,
I would like to know how to find out the home directory of a particular user..
eg,
If am the root , then my Home directory will be /
if say am just a user logging into the terminal then my home dir would change,
so accordingly i would like to know how to find it out...
I know that... (7 Replies)
Hi all,
i have to need one script:
1. it will capture the unused user accounts in /export/home directory.
2. it will capture the locked user accounts in /export/home directory.
Note: locked accounts will show in /etc/passwd like /bin/false --> (instead of ksh it will show false)
the... (1 Reply)
The home directory for me on my system is on /home/kwon. It was created using "useradd kwon"
When i go to change the home directory for a user doing a usermod -d /home/test when they log on it gives them messages saying to generate new ssh keys, and it does. It gives me a thing that says... (1 Reply)
Hello
How do i restrict a user only to his own directory so that he wont be able to cd to other directories.
say for excample there is user called xiamin then xiamin should be restricted to /usr/xiamin only.
i am on redhat linux
regards
Hrishy (4 Replies)