Write a shell script that lists just the directories belongi
Write a shell script that lists just the directories belonging to a specific UID (create a new UID to represent an average user).
(Include the shell code to produce the results). In your answers show a specific example which demonstrates that your script works as desired.
Solution
Shell Script:
useradd –u 999 abc
i=$(id –u abc)
find /home/ -uid $i
Explanation :
using useradd command we can create user named as abc with user id 999.
We stored userid in variable i.
Using find command we find the user and list the directories in the specific user id.
The UID of 0 has a special role : it is always for the root account.
UID’s 1 through 99 are reserved for special system users(pseudo users).
UID 65534 is reserved for nobody , a user with no system privileges .
Remaining user id’s we can specify as user id’s.
