Hide Directory name


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Hide Directory name
# 1  
Old 12-07-2003
Question Hide Directory name

Hello everyone,
i am new to unix and still learning about different commands. Can some one tell me how can i hide my directory name. For instance someone is logged in a directory named [home:/user/myname]$ .
I've seen some people hiding their above path name by just one word or letter like [anything]$ in order to keep their path hidden for security reasons. I also heard from some people that i have to do changes in my .profile file. Can some one help me out with this and tell me how do i do so!
Thank You

Last edited by a25khan; 12-07-2003 at 02:27 AM..
# 2  
Old 12-07-2003
If you use (ba)sh, try

export PS1='[\u@\h]$'

But I don't think it's a security feature having to remove the current directory from the shell prompt. It's just inconveniencing yourself when you need to use relative paths and don't know whether your current directory is the one intended.
# 3  
Old 12-07-2003
MySQL

Hello cbkihong,
Yes I use bash and it worked Smilie. Thanks to you ofcourse!Smilie

Last edited by a25khan; 12-07-2003 at 10:13 AM..
# 4  
Old 12-08-2003
I dont know about you, but I really like to know what directory I am in... and whether I am root or not...

I use this as my root prompt. So I know for a fact when root is logged in and where I am. That is 2 lines on purpose for root... if you were wondering.


PS1="`hostname`-$LOGNAME:\${PWD#*}
# "


For my users, I use this prompt.

PS1="`hostname`:/\${PWD#*}> "
# 5  
Old 12-09-2003
Question

Hi there,
ok i used the command you posted i.e. PS1="`hostname`:/\${PWD#*}> "
But can you tell me how does this work? I mean what is PS1 (i guess it's a variable)?
Why do you have a hash sign after pwd and what about the curly braces? And you are redirecting it with ">".
Can you please elaborate on the above? Thank you Smilie
# 6  
Old 12-09-2003
you can type command 'set' to view all command prompts.

PS1 to PS4

PS1 is default shell prompt

PS2 is secondary prompt string. If you type command like ls -l "file* and then press enter. Then you will see this prompt.

PS3 is a selection prompt string and it is used for select loop usually. The prompt lets user know that who need to enter something to reply to the script.

PS4 is used for execution trace. If you have a script and the content is
ls -l
Then you run it as
ksh -x scriptname

Then you will see a symbol before each process for execution trace. Which is useful for troubleshoot any script errors.

About the prompt question,
PS1="`hostname`:/\${PWD#*}> "

`hostname`
I think that you should know the this part.

${PWD#*}
To get the same prompt, then I will type
export PS1=`hostname`':/$PWD >'

">" it doesn't mean redirect because it has been quoted by double quotes
# 7  
Old 12-09-2003
My prompt appears as follows for root:


THIS :

PS1="`hostname`-$LOGNAME:\${PWD#*}
# "

GIVES THIS:

hostname-root:/root
#
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

How to hide from UNIX strings - obfuscate or hide a literal or constant?

Hi, I need to somehow pipe the password to a command and run some SQL, for example, something like echo $password | sqlplus -s system @query01.sql To make it not so obvious, I decided to try out writing a small C program that basically just do echo $password. So now I just do x9.out | sqlplus... (8 Replies)
Discussion started by: newbie_01
8 Replies

2. Shell Programming and Scripting

ls - hide permissions

I'm listing the files in a particular directory using the ls command... $ ls -ogh total 9.4G -rw-r--r-- 1 1.9G Nov 4 02:29 file1.tar -rw-r--r-- 1 1.9G Nov 11 03:11 file2.tar -rw-r--r-- 1 1.9G Nov 18 02:55 file3.tar -rw-r--r-- 1 1.9G Nov 25 03:11 file4.tar -rw-r--r-- 1 1.9G Dec 2 02:46... (3 Replies)
Discussion started by: cdunavent
3 Replies

3. Shell Programming and Scripting

Hide process

Hi friends, I want (a C++ code) to hide process in kernel 2.6, I don't want monitoring even in /proc. please help me. Regards, Eilya (3 Replies)
Discussion started by: Eilya
3 Replies

4. Shell Programming and Scripting

How to hide folders

hello everybody, i would like to hide visibility of the folders , i.e. not to giving any physically visibility to any users . Is there any way to do it other than changing the permission and adding "." post folder name . by changing the permission , we cann't do any activity , but have... (1 Reply)
Discussion started by: manas_ranjan
1 Replies

5. Shell Programming and Scripting

Want to hide password

All, In my script I am calling another script.. in that script I need to enter a password. Problem is that everyone is able to see the password when I enter that. Is there any way that when i enter that password it should not display or may look like *******. Or if there any other way that I... (1 Reply)
Discussion started by: arpitk
1 Replies

6. Shell Programming and Scripting

Hide a script ?

Hi all, i have a perl script for my users to run. My sys admin created an account for the users to log in and execute the script. They just type "perl myscript.pl" at the unix prompt to run it. Is there any way that i can hide my script? ,ie, do not allow my users to view the script. either... (5 Replies)
Discussion started by: new2ss
5 Replies

7. HP-UX

How to hide files in unix

Hi all I am new to unix...... i am working on HP-UX I like to know how to hide files and how to view hided files created by other users also please help me Sireesha (1 Reply)
Discussion started by: Sireesha NP
1 Replies

8. Shell Programming and Scripting

Hide Passwords

Is there a way not to display the password in the sys out when your korn shell script logs into sqlplus? (3 Replies)
Discussion started by: lesstjm
3 Replies

9. Programming

hide password typing

I am doing a project in C program which requires to type in password in Unix terminal. Does anybody know how to shade or not output any words typed by user in the terminal? I use the function scan() to read typing from user. Thanks in advance. (2 Replies)
Discussion started by: ivancheung
2 Replies
Login or Register to Ask a Question