0

How to pass and get variables to user account from root account using shell script

Is it possible to pass the variables to user account through root account, using shell script...? i tried lot. when i try to get the user variable values using " echo" command. i get only empty space. please help me to solve this problem....

gibbson
asked Oct 25, 2017
1 Answer
0

"Yes it is possible. Follow these steps:
To run your script as another user as one command, run:

/bin/su -c ""/path/to/backup_db.sh /tmp/test"" - postgres

Breaking it down:
 /bin/su : switch user
 -c ""/path/to..."" : command to run
 - : option to su, make it a login session (source profile for the user)
 postgres : user to become"
View More
linuxhelp
answered Jan 26, 2019
Your Answer
||||
 
100:0