Sponsored Content
Full Discussion: How to store username
Top Forums Shell Programming and Scripting How to store username Post 10249 by dinplant on Saturday 10th of November 2001 10:52:01 AM
Old 11-10-2001
Question How to store username

I would like to write files to a directory (not under the user's home) which includes the userid.

Example:
userid = john
John's home dir is /home/john

I want to create a directory /var/prog/john


MSG_HOME=/var/prog; export MSG_HOME;
USR_NAME=@@@@; export USER_NAME;


if [ ! -d "$MSG_HOME/$USR_NAME" ];

then
mkdir $MSG_HOME/$USR_NAME || USAGE_EXIT "Unable to create " "$MSG_HOME/$USR_NAME "

fi

How do i define @@@@ ?

id -u -n will return john

but how do I get is assigned to USR_NAME?
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grabing the username

Hi, Is there a way to grab the username who is running the shell script. I am trying to do is: $ who am i Peterd123 pts/5 Mar 20 09:30 (H0021563.xyz.com) Is there a way to display only the user name above, which is"Peterd123". Thanks Raj (3 Replies)
Discussion started by: rkumar28
3 Replies

2. Post Here to Contact Site Administrators and Moderators

What to change my username

I want to change my username how can I (1 Reply)
Discussion started by: alnita
1 Replies

3. Post Here to Contact Site Administrators and Moderators

username

Is it possible to change my username in this site or is thre a way to delete my account and then create a new one with a diffrent user name (2 Replies)
Discussion started by: floresr
2 Replies

4. Shell Programming and Scripting

SFTP with '@' in username

Hi All, Good morning !! I have to connect to a sftp server using following details, 1) username contains "@" as part of it. eg: xyz@abc@servername 2) We have to use password to connect to the server. Could you please advise the solution for this? Thanks in advance Regards, Mohan (1 Reply)
Discussion started by: mohanpadamata
1 Replies

5. Shell Programming and Scripting

Username and password

Hi I am new to using unix and am struggling with a script i am writing. What i am trying to do is get a user to enter a username, check the original file i created with username and pin to see if their is a corresponding entry. Next ask the user to enter the pin and see if this matches... (5 Replies)
Discussion started by: somersetdan
5 Replies

6. Post Here to Contact Site Administrators and Moderators

Is it possible to change my username?

I know username is the unique id for my unix_dot_com account, but is it possible change it ? should i raise any special request to moderators ? (2 Replies)
Discussion started by: Arun_Linux
2 Replies

7. Post Here to Contact Site Administrators and Moderators

Change of username

Hi, I'd like to change my username..... is there a mechanism to do this or can you do it? (1 Reply)
Discussion started by: Martincorneuk
1 Replies

8. Post Here to Contact Site Administrators and Moderators

Do I need to change my Username/PW?

After mis-typing my password once, I logged in. And after the "welcome Clovis_Sangrail" message displayed for a little less than a second, the display changed to a screen to recover my username and/or my password (it prompted for an email address). Clearly, I don't need to do that. Maybe... (1 Reply)
Discussion started by: Clovis_Sangrail
1 Replies

9. UNIX for Beginners Questions & Answers

Why does "ps -[u|U] username" not list processes when username is numeric?

Greetings, The title pretty much says it all. I've snooped everywhere and can't find anything on this. Since our organization went to numeric usernames, using the u|U option for ps returns no processes. Example passwd entry: 320074:DjZAJKXun8HBs:10129:6006:Joe Y:/cadhome/analysis/jy:/bin/bash... (4 Replies)
Discussion started by: crimso
4 Replies
removeuser(8)						      System Manager's Manual						     removeuser(8)

NAME
removeuser - Deletes user accounts interactively SYNOPSIS
/usr/sbin/removeuser DESCRIPTION
Security Note If you have enhanced security installed on your system, you should use the dxaccounts command to remove users. See the Security manual and the dxaccounts(8) reference page for more information. The removeuser command is an interactive command for deleting user accounts from your system. It also gives the option of deleting the user's home directory, files and mail. The command prompts you for specific information and informs you of its activity and error condi- tions. The removeuser command invokes /usr/sbin/userdel to delete the user account information from /etc/passwd and the hashed password database (if present). Only the superuser can execute this command. The command performs the following tasks: Asks for a login name for the user to be deleted. Enter the login name. If this entry does not exist in the /etc/passwd file, the command informs you of this and exits. If the entry does exist, the command continues. Displays the entry for the user from the /etc/passwd file and asks if this is the entry you want to delete. If the answer to this query is no, the com- mand indicates that the user was not deleted and then exits. If the answer to this query is yes, the command deletes the user's entry from the /etc/passwd file and any occurrences of the user from the /etc/group file. It then states that the user was deleted. Searches several administrative directories and files for occurrences of the user and informs you if they exist. If so, it suggests that you may want to delete these occurrences when the command is finished. If no occurrences of the user are found in these directories and files, the command indicates so. Asks if you want to delete the home directory, all subdirectories, and all mail files for the user. If the answer to this query is no, the command indicates that the user's home directory was not deleted and then exits. If the answer to this query is yes, the command continues. As a precaution, the command reminds you that you should have backed up the files for the user before removing them if you do not want to lose them. It then asks if you are sure that you want to delete the files for this user. If the answer to this query is no, the command indicates that the user's home directory was not deleted and then exits. If the answer to this query is yes, the command states that it is removing the user's home directory, its contents and the user's mail file. It then deletes these items. At this point, the command ends. NOTES
Users are advised to migrate to the /usr/sbin/userdel utility or the dxaccounts utility as this command may be removed in a future version of the operating system. EXAMPLES
Enter a login name to be removed or <Return> to exit: john This is the entry for (john) in the /etc/passwd file: john:VSh6/xbMqPDcY:5006:15:sdf:/usr/users/john: Is this the entry you want to delete (y/n)? y Working ... Entry for (john) removed. Searching relevant directories and files for (john) ... None found. Do you want to remove the home directory, all subdirectories, files, and mail for (john) (y/n)? y The files for (john) will be lost if not backed up. Are you sure you want to remove these files (y/n)? y Deleting /usr/users/john Deleting /usr/spool/mail/john FILES
Specifies the command path Group file Password file SEE ALSO
Commands: addgroup(8), adduser(8), dxaccounts(8), finger(1), mkpasswd(8), passwd(1), useradd(8), userdel(8), vipw(8) Files: group(4), passwd(4) removeuser(8)
All times are GMT -4. The time now is 05:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy