New Approach Hiding login password from ps -ef


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers New Approach Hiding login password from ps -ef
# 8  
Old 04-21-2009
How about if you wrote a script named ps to replace the ps program (which you renamed to, say, ps.bin or something.

Then in the script you say if not xxx user run ps.bin otherwise do nothing or whatever would be better.
# 9  
Old 04-22-2009
Thanx GSalisbury. I am still wondering is there no simple straighforward way to do this.

I am new to UNIX. I am sure there must be a way thru some os permission setting.

I see this is such a basic requirement. WHy would we even need to write a script to do this.

Dont you think the OS should be able to handle this.
Its like in a Database I can easily revoke permissions from a procedure from a specific USER.
Would the OS not have such a provision for a specific user ?

Thanx
# 10  
Old 04-22-2009
Well... not wanting to get drawn into a big debate as others may have more intimate knowledge... but that's pretty much the way it is.

Generally speaking if "it's on the path" and executable to the user than it runs. There is no inherent user/command "matrix".

"nix" provides the flexibility for you to implement the by user controls if you wish a number of different ways.

You could use the rename and intercepting script method.

You could alter the user's path (at login) so they can't see it or what they see is something different and/or in a different place (a variation on the intercepting script method).

As root:

. make a directory:
mkdir -m755 /.bin_trap

. make an empty file named ps in that directory:
cp /dev/null /.bin_trap/ps
or a non-empty file to do whatever is good for you

. make that file executable:
chmod 555 /.bin_trap/ps

Then in the user's login script set the path variable to have your /.bin_trap at the beginning of the list so your ps is found first. The syntax for doing that varies depending upon the shell in use.

Of course, a reasonably astute user would eventually be able to get around that but, perhaps, you're not concerned there.

Geo.
# 11  
Old 04-23-2009
I feel your asking the wrong question....

you are passing a password into a command/script?
then you can see the password in the full commandline using ps -ef
# 12  
Old 04-23-2009
GSalisbury,
Thanx again for your valuable inputs.
I will try the .bin_trap method which you suggested.
I wish unix was a bit flexible.


robsonde,
I hear you but I am asking the apprpriate question. This requirement could be generic for any utility not just ps.
Thanx for your inputs. I agree sometimes we do ask the wrong question to because we think there lies the solution Smilie
# 13  
Old 04-24-2009
radoulov post shows how not to place the Oracle username and password on the command line ... which makes it not visible in "ps".

To stop "ps" for a particular user, try alias in their profile. Ensure that root owns the profile to stop the user making changes.

Code:
alias ps='false'


Last edited by methyl; 04-24-2009 at 07:50 AM.. Reason: Typo
# 14  
Old 04-24-2009
Remove privledges from Testuser

try
Code:
chmod 554 /bin/ps

Provided u have root privledges for this command
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Password hiding in UNIX

Hi guys, I use STTY command to make the password invisible. Now I need to write the password into another file pwd.txt, but in an invisible manner, something like ******. Another thing is to when I echo the content of pwd.txt I get the password I actually typed. Thanks guys. Help me out. (5 Replies)
Discussion started by: mohanalakshmi
5 Replies

2. Shell Programming and Scripting

Remote call not hiding password fields

Not sure on the description, but here is a quick rundown. I have 2 servers, we'll call them serverA serverB On serverB, I am calling a script that inside it has the following: ssh srvdsadm@serverB sudo -u dsadm /opt/apps/DataStage/scripts/autoDeploy.sh ${projName} ${subProjVar}... (1 Reply)
Discussion started by: cbo0485
1 Replies

3. Shell Programming and Scripting

Scripting help/advise on hiding/masking username/password

Hi, I currently have a UNIX script with a function that uses a username and password to connect to the database, retrieve some information and then exit. At the moment, am getting the username and password from a hidden plain text file and permission set to -r--------, i.e. read only to who... (1 Reply)
Discussion started by: newbie_01
1 Replies

4. Solaris

SSH Password-less login fails on password expiry.

Hi Gurus I have a few Sol 5.9 servers and i have enabled password less authentication between them for my user ID. Often i have found that when my password has expired,the login fails. Resetting my password reenables the keys. Do i need to do something to avoid this scenario or is this... (2 Replies)
Discussion started by: Renjesh
2 Replies

5. UNIX for Dummies Questions & Answers

Hiding Password

Hello. A bit of a puzzle here: I have a 3rd party executable, which requires the following parameters: parm1 = program_name, parm2=userid/password, parm3=additional flags. We tried passing password as a variable, but you can do grep, and see what the password actually is I found a bit... (2 Replies)
Discussion started by: Kishinevetz
2 Replies

6. Shell Programming and Scripting

Hiding password for FTP in a script

Hi, I have a simple script to ftp from unix to a mainframe to get and put files. Currently I have the password setup in a VARS file and dereference the var in my script. Doing it this way allws me to change the password in only one place but it is still viewable for many people. Is there any... (6 Replies)
Discussion started by: Cass3
6 Replies

7. UNIX for Dummies Questions & Answers

Hiding login/password in process!

Hello, I am trying to figure out away to hide a command from users when performing a ps check. I have a ksh that purges a table in a database. If I perform a >ps -eaf |grep ksh, I get the login id and password. I do not want other users seeing this. Is there a way to hide this. The login... (5 Replies)
Discussion started by: ctcuser
5 Replies

8. Shell Programming and Scripting

Hiding password from ps

I'm calling a program with a command line arguement containing a password. while the process is running anyone on the system can ps -ef and see the password. Is there a way to prevent this from happening. example PROGRAM USERNAME/PASSWD I've also tried PROGRAM `cat passfile` ... (7 Replies)
Discussion started by: sudojo
7 Replies
Login or Register to Ask a Question