LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-04-2014, 12:05 PM   #1
semple1990
LQ Newbie
 
Registered: Jul 2014
Posts: 1

Rep: Reputation: Disabled
Hiding a password from process status


Hi All,

Not sure if this is actually possible, or if there is a more suitable method...

I set a password for the rar command (rar a folder.rar -hpThisIsThePassword.....)

However if I search for this process, the password is displayed:

Code:
ps -ef | grep rar

30480 30418 89 18:43 pts/8    00:00:13 rar a folder.rar -hpThisIsThePassword
Obviously on a shared server this makes using the password in the first place a waste of time.

Is there another method I can use to prevent the password from showing?

Thanks in advanced.
 
Old 07-04-2014, 05:42 PM   #2
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
Maybe you could store the rar password in a file somewhere (assuming only your user permissions have access to it) and then run the command like so:

Code:
$ rar a folder.rar -hp`cat somefile`
Can't think of anything else.
 
Old 07-05-2014, 08:01 PM   #3
${i}
LQ Newbie
 
Registered: Jul 2014
Posts: 22

Rep: Reputation: 9
Quote:
Originally Posted by semple1990 View Post
Is there another method I can use to prevent the password from showing?
You could store the password in a variable and then use the variable in the command string.

Code:
read -e -s -p "pass?" mypasswd
You will be prompted to enter your string. The string will not echo as you type.

Next, run your rar command like so

Code:
rar a folder.rar -hp$mypasswd
This will also keep your password not recorded in your history file.

Last edited by ${i}; 07-05-2014 at 08:32 PM.
 
Old 07-05-2014, 09:03 PM   #4
${i}
LQ Newbie
 
Registered: Jul 2014
Posts: 22

Rep: Reputation: 9
I believe coralfang's method is better than mine because the password is store in a file. My method above will hide the password but it requires interaction from you.

If you want to make a strong password for your rar archive and store it in a file, you can run this command

Code:
tr -dc [:graph:] < /dev/urandom | head -c 15 | xargs -0 > somefile
This will produce a 15 character random string of numbers, letters and symbols. You can adjust the length of the string by changing the value in red.

Next, chmod your file, like so

Code:
chmod 600 somefile
Only the owner will have read-write access to the file and blocked to everyone else.

Now you can run the command that coralfang gave you

Code:
rar a folder.rar -hp`cat somefile`

Last edited by ${i}; 07-05-2014 at 09:13 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding smb mount password in fstab? Hashing? humbletech99 Linux - Networking 6 09-13-2021 10:19 AM
Scripting help/advise on hiding/masking username/password newbie01.linux Linux - General 2 03-15-2010 09:29 AM
Hiding password in /boot/grub/menu.lst jdkaye Debian 4 05-04-2009 07:46 AM
hiding a process hoshangi Programming 3 12-18-2007 03:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration