1846892 Members
3497 Online
110256 Solutions
New Discussion

Re: About su

 
hanyyu1
Advisor

About su

In the system , there is a system user ( eg. adm_usr ) that is assigned to run a system process ( program1 ) , now I want to let user have the permission to run this program , so I want the user can su to this user before run the program ( like below ) , but now it can't becaus the ID adm_usr is not null password , is it possible ? thx.


# vi program1
touch file1
su - adm_usr
cp file1 file2
7 REPLIES 7
Sivakumar TS
Honored Contributor

Re: About su


Hi,

You can do this with single command itself,

#su - adm_usr -c

-c option allows us to execute a command after su.

With Regards,

Siva.
Nothing is Impossible !
RAC_1
Honored Contributor

Re: About su

Unless thay know adm_usr password, they can not do that. You can use sudo to achive what you want to do.
There is no substitute to HARDWORK
hanyyu1
Advisor

Re: About su

thx replies ,

hi RAC
with the su command , if i just want to let the user can su to adm_usr and copy a file to a specific path , what can I do ? thx.
RAC_1
Honored Contributor

Re: About su

Set sudo to allow for copying of files to intended users. Install sudo and configure it to do as follows.
user_alias group1 = "user1 user2 user3"
cmnd_alias copy="cp source_file dest_file"

group1 ALL=copy NOPASSWD:ALL
There is no substitute to HARDWORK
Muthukumar_5
Honored Contributor

Re: About su

May be you can choose ways as,

1) installing sudo and giving permission to use cp command with adm_user

2) setting up r* command execution setup and use rcp

3) If you know the password of adm_usr account then use ftp with user command option

4) You can use expect scripting to achive this

5) You can use telnet piping also as,

(
sleep 1
echo "adm_user"
sleep 2
echo ""
sleep 1
echo "cp file1 file2"
sleep 2
echo "exit 0"
) | telnet localhost

-Muthu
Easy to suggest when don't know about the problem!
hanyyu1
Advisor

Re: About su

thx reply ,

I tried your method , but I am not too understand it, If I want any user who run the program ( program1 ) can copy any file to a specific path , while login ID adm_usr:ADM have this permission to do it , what can I do ? thx
hanyyu1
Advisor

Re: About su

thx Muthukumar ,

I just want to cp to localhost . thx