Visit Our UNIX and Linux User Community

Looking for config file in home directory first??

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Looking for config file in home directory first??
# 1  
Old 05-16-2013
Looking for config file in home directory first??


i have written a shell script inside which i am using a pgp command to encrypt a file. when pgp command is run , there is a /.pgp/pgp.cfg file in my home directory.
i logged into the unix server with my userid, when i run the script from the command prompt, pgp is successful, since i am logged in with my username.

but when i run the script from a web interface , pgp command fails. since a different user is running the script.

error in the log file is
"Error: Unable to open config file /var/www/.pgp/pgp.cfg, No such file or directory."

this is because i have not set the pgppath in the shell script.

so my question is, when i ran it from command prompt after loggin in with my username, it read the pgp.cfg file from /.pgp/pgp.cfg in my home directory.

but when i tried running from web interface as a different use , it tried to search for pgp.cfg in /var/www/.pgp/ directory.

1) From command prompt after loggin in with my userid
why it didnot tried to look for the pgp.cfg file in /var/www/.pgp/ directory , why did it looked into my home directory for pgp.cfg file?

2) From web interface , calling the script as a different user,

why did it try to look for pgp.cfg in /var/www/.pgp/ directory.
# 2  
Old 05-16-2013
You might want to add few path settings... also if possible copy the .pgp keys onto the path

#at start
export PATH=$PATH:/opt/pgp/bin
#at end

# 3  
Old 05-16-2013
but , is it like 1st it will try to search for the file in home directory and if it is not found then it will search in /var/www/ directory?
# 4  
Old 05-16-2013
can you please post the way you used pgp with in your script?
# 5  
Old 05-16-2013
pgp --encrypt --text filename --user "pgp_user_id" --output filename.pgp

i used it like this.
# 6  
Old 05-16-2013
I used pgp long back..However I am pretty sure the key (private) is user specific so if you created the key pair from user1 and trying to decrypt it from user2 it will fail.

Whenever you try to generate pgp key pair it will store it under /home/username/.pgp/pgp.cfg this means its user specific files and stored under home directory of individual user.

---------- Post updated at 02:41 PM ---------- Previous update was at 02:34 PM ----------

also.. is it error or warning?

Previous Thread | Next Thread
Test Your Knowledge in Computers #652
Difficulty: Easy
Puffy is the mascot of Linux Mint.
True or False?

9 More Discussions You Might Find Interesting

1. Solaris

SunOS confusing root directory and user home directory

Hello, I've just started using a Solaris machine with SunOS 5.10. After the machine is turned on, I open a Console window and at the prompt, if I execute a pwd command, it tells me I'm at my home directory (someone configured "myuser" as default user after init). ... (2 Replies)
Discussion started by: egyassun
2 Replies

2. UNIX for Dummies Questions & Answers

Duplicated file names with home directory symbol appearing in ls .

Why are there duplicated file names listed when I execute ls ? Result of my ls /root/Desktop : aaa ca new file~ what what~ Thanks. (4 Replies)
Discussion started by: Hijanoqu
4 Replies

3. Shell Programming and Scripting

Cannot run this .java file from the home directory??

I wrote a simple program in vi. I know it compiles correctly because I went into the directory where was and compiled it and it created a java.class. I then ran by staying in the same directory where it was and it worked great. However, when i backed out of the... (3 Replies)
Discussion started by: syregnar86
3 Replies

4. Shell Programming and Scripting

rename all file with blank in directory from home root , please help me

hi , :wall: I've in directory home user 3 file with blank space in name file, I would like erase the all character that no have alphanum more dot in namefile from home root , below the script. If I execute the shell script from directory where stay it's execute well done.But I would like... (1 Reply)
Discussion started by: giankan
1 Replies

5. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

6. UNIX for Dummies Questions & Answers

How to get the latest modified file name in /home directory?

I only know how to list all sub-directories or files in specified directory. I don't know how to order them by modified date, furthermore, I don't know how to get the top one file in the sorted list. Wish you can do me a favor. Thanks in advance! (3 Replies)
Discussion started by: crest.boy
3 Replies

7. Shell Programming and Scripting

parsing config file to create new config files

Hi, I want to use a config file as the base file and parse over the values of country and city parameters in the config file and generate separate config files as explained below. I will be using the config file as mentioned below: (config.txt) country:a,b city:1,2 type:b1... (1 Reply)
Discussion started by: clazzic
1 Replies

8. Solaris

Restricting SFTP user to a defined directory and home directory

Hi, I've created solaris user which has both FTP and SFTP Access. Using the "ftpaccess" configuration file options "guest-root" and "restricted-uid", i can restrict the user to a specific directory. But I'm unable to restrict the user when the user is logged in using SFTP. The aim is to... (1 Reply)
Discussion started by: sftpuser
1 Replies

9. UNIX for Dummies Questions & Answers

Searching a file withoug leaving home directory!!

hello there ! I am in my current working directory, and i want search a file in "dev" directory which is under root(/), but i donot want leave my current working directory. is it possible to find file like that ? let us say i am in /home/bin/user/malik/abid directory and i want find a file... (2 Replies)
Discussion started by: abidmalik
2 Replies

Featured Tech Videos