Sponsored Content
Top Forums Shell Programming and Scripting IF $USER is not in this list of users, then do this Post 302361975 by glev2005 on Wednesday 14th of October 2009 03:04:58 PM
Old 10-14-2009
IF $USER is not in this list of users, then do this

I need to add to a BASH script if ${USER} is not in a list of users (smitha, brownd, adamsp) then do something... what is the best shortest way to accomplish an if statement with a list like this? Also the list of users should be in the script, not an external file.

Thanks!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

su - user... how to find out the list of users and their passwords..

hi, to do a su - user, we need to know what are the users... so in unix 1) which file to see the list of users, passwords? (2 Replies)
Discussion started by: yls177
2 Replies

2. AIX

Script allows user to kill other users: I'd like to know HOW...

Hello list, Have a problem that's highlighting gaps in my knowledge; can you assist? We have a script that's tacked onto our trading application which allows branch managers etc. to kill off the sessions of other users at their branch. A menu option in the application spawns a shell running... (8 Replies)
Discussion started by: alexop
8 Replies

3. AIX

cloning users access with different user name

Hi! this would be my first time to post here in this forums, hope you can help me with my queries. i would like to create a different user name but have the same access rights. Example: root > rootbaby. thanks (5 Replies)
Discussion started by: HPL1706
5 Replies

4. UNIX for Dummies Questions & Answers

User Name and Password List/adding and removing users.

Hello everyone and let me start off by thanking anyone who can help with this. I work for a company that uses Unix as one of their servers. I'm not at all familar with Unix beyond logging after I restart the server:rolleyes: I'm looking for some command that will bring me up a list of current... (3 Replies)
Discussion started by: disgracedsaint
3 Replies

5. Shell Programming and Scripting

script to ignore the user from list of users

Hi, I have a situation where I want to ignore few users from list of users and print rest of user in log file. say, I want to ignore aaa, bbb, ccc, ddd .. ppp from list of 20 user (do not want to include) What is the good command or any script? Thanks in advance. (1 Reply)
Discussion started by: sumit30
1 Replies

6. UNIX for Advanced & Expert Users

list of users

Hello!Does anybody know how to solve this script: ,,write a shell script which displays a list of names of users who have created files "*. c" in the last day."? (1 Reply)
Discussion started by: theodoraa
1 Replies

7. UNIX for Dummies Questions & Answers

Not able to switch to other users using su -user from root

Hi all, I have a small problem. When I log in as root and try to switch to any other user using su -user, then it is giving an error saying libncurses.so permission denied. Can you help me? Thank you in advance. Sai. (1 Reply)
Discussion started by: sai2krishna
1 Replies

8. UNIX for Advanced & Expert Users

Need to find the user id of all users in UNIX

I need to find all the unix user id's of all the users in unix... is there any such command... pl help out (6 Replies)
Discussion started by: Syed Imran
6 Replies

9. UNIX for Dummies Questions & Answers

Users list

Hi i would like to know were the folder that contain file with list of all users ? And were i can learn about what kind of folder i have and wheat they have inside? question 2. when i write ls -a i see all directories and then i choose for example Documents and inside Documents i typed again... (1 Reply)
Discussion started by: iliya24
1 Replies

10. Shell Programming and Scripting

List the Manager of Users in AD - Using list- Get-ADuser

Is there any command that can used in Linux that export usernames and their manager's name from AD using bash shell script? I know this can be done using powershell but I need to use Linux for this procedure. (2 Replies)
Discussion started by: dellanicholson
2 Replies
CREATE 
USER(7) SQL Commands CREATE USER(7) NAME
CREATE USER - define a new database user account SYNOPSIS
CREATE USER username [ [ WITH ] option [ ... ] ] where option can be: SYSID uid | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password' | CREATEDB | NOCREATEDB | CREATEUSER | NOCREATEUSER | IN GROUP groupname [, ...] | VALID UNTIL 'abstime' DESCRIPTION
CREATE USER will add a new user to an instance of PostgreSQL. Refer to the Administrator's Guide for information about managing users and authentication. You must be a database superuser to use this command. PARAMETERS username The name of the user. uid The SYSID clause can be used to choose the PostgreSQL user ID of the user that is being created. It is not at all necessary that those match the Unix user IDs, but some people choose to keep the numbers the same. If this is not specified, the highest assigned user ID plus one (with a minimum of 100) will be used as default. password Sets the user's password. If you do not plan to use password authentication you can omit this option, but the user won't be able to connect to a password-authenticated server. The password can be set or changed later, using ALTER USER [alter_user(7)]. ENCRYPTED UNENCRYPTED These keywords control whether the password is stored encrypted in pg_shadow. (If neither is specified, the default behavior is determined by the PASSWORD_ENCRYPTION server parameter.) If the presented string is already in MD5-encrypted format, then it is stored as-is, regardless of whether ENCRYPTED or UNENCRYPTED is specified. This allows reloading of encrypted passwords during dump/restore. See the chapter on client authentication in the Administrator's Guide for details on how to set up authentication mechanisms. Note that older clients may lack support for the MD5 authentication mechanism that is needed to work with passwords that are stored encrypted. CREATEDB NOCREATEDB These clauses define a user's ability to create databases. If CREATEDB is specified, the user being defined will be allowed to cre- ate his own databases. Using NOCREATEDB will deny a user the ability to create databases. If this clause is omitted, NOCREATEDB is used by default. CREATEUSER NOCREATEUSER These clauses determine whether a user will be permitted to create new users himself. This option will also make the user a supe- ruser who can override all access restrictions. Omitting this clause will set the user's value of this attribute to be NOCREA- TEUSER. groupname A name of a group into which to insert the user as a new member. Multiple group names may be listed. abstime The VALID UNTIL clause sets an absolute time after which the user's password is no longer valid. If this clause is omitted the login will be valid for all time. DIAGNOSTICS
CREATE USER Message returned if the command completes successfully. NOTES
Use ALTER USER [alter_user(7)] to change the attributes of a user, and DROP USER [drop_user(7)] to remove a user. Use ALTER GROUP [alter_group(l)] to add the user to groups or remove the user from groups. PostgreSQL includes a program createuser [createuser(1)] that has the same functionality as this command (in fact, it calls this command) but can be run from the command shell. EXAMPLES
Create a user with no password: CREATE USER jonathan; Create a user with a password: CREATE USER davide WITH PASSWORD 'jw8s0F4'; Create a user with a password, whose account is valid until the end of 2001. Note that after one second has ticked in 2002, the account is not valid: CREATE USER miriam WITH PASSWORD 'jw8s0F4' VALID UNTIL 'Jan 1 2002'; Create an account where the user can create databases: CREATE USER manuel WITH PASSWORD 'jw8s0F4' CREATEDB; COMPATIBILITY
The CREATE USER statement is a PostgreSQL extension. The SQL standard leaves the definition of users to the implementation. SEE ALSO
ALTER USER [alter_user(7)], DROP USER [drop_user(l)], createuser(1) SQL - Language Statements 2002-11-22 CREATE USER(7)
All times are GMT -4. The time now is 05:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy