Operating System - HP-UX
1838496 Members
2513 Online
110126 Solutions
New Discussion

Change owner to few user ids

 
HCL123
Occasional Advisor

Re: Change owner to few user ids

chown file/dir

#chown username:group file/dir

#chown -R username:group dir
unixadmin_1
Frequent Advisor

Re: Change owner to few user ids

Hi Dennis,

awk -F: '
{
# print $1, $3, $5
if ($1 == "+") next
if ($5 == "") {
print "No user name for", $1
}
if ($3 == 0) {
print "superuser", $1, $5
if ($1 != "root") {
print "superuser but not root:", $1, $5, "<******"
}
}
}' /etc/passwd

These are still turning around in my mind:
1)with what file name should i save the above code
2)under which directory folders should i save this.
3)how to run the above code please mention and reply me urgently
Dennis Handly
Acclaimed Contributor

Re: Change owner to few user ids

>1) with what file name should I save the above code?

Whatever you want. It is a shell script fragment. You can use ksh, sh or even scummy C shell. It just has to be executable. Or you can enter it directly into your shell.

>2)under which directory should I save this?

Whatever you want.

>3)how to run the above code?

It is a multi-line shell command.
You can also change it into awk command file as in your other thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1305681

If our answers were helpful, please read the following about how to assign points:
http://forums.itrc.hp.com/service/forums/helptips.do?#33
unixadmin_1
Frequent Advisor

Re: Change owner to few user ids

Thanks