Operating System - HP-UX
1824994 Members
2131 Online
109678 Solutions
New Discussion юеВ

Script to remove user account

 
Ngoh Chean Siung
Super Advisor

Script to remove user account

Hi,

1) I need a script to remove user id. It is same as the remove user through SAM. And should remove from all local files system. Input is the user id. Any ideas? I know the command used to remove user id is /usr/lbin/userdel. Is it possible to remove the user id from /etc/ftpd/ftpusers in this script as well?

2) What is /usr/sam/lbin/upusrfiles for?

regards
2 REPLIES 2
Sridhar Bhaskarla
Honored Contributor

Re: Script to remove user account

Hi,

1. What sam does is to effectively execute 'userdel -r ' and then fire up a background job with a 'find' to find and delete the files owned by that user. Yes. It is possible to remove the user id from the ftpusers file through the script. It's too late for me now. But, someone can definitely help you.

2. It's used by sam to manipulate the logins. I believe it is expected to run from SAM only. You could use userdel.sam though.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Ngoh Chean Siung
Super Advisor

Re: Script to remove user account

Hi,

userdel -r is used to remove user id including the home directory. How to pipe all the deleted file info into /var/sam/sam_remove.log?

As I know, when removing the user account through SAM, all the deleted file info will be pipe into /var/sam/sam_remove.log.

Below is the command that I used in my script:
/usr/sam/lbin/userdel.sam -r $userid

Note: $userid is the user id to be removed.

regards.