cancel
Showing results for 
Search instead for 
Did you mean: 

sudo

SOLVED
Go to solution
DeafFrog
Valued Contributor

sudo

Hello Gurus ,

using sudo i want to copy a file , there's the command that i am using

/usr/local/bin/sudo /usr/bin/cp /CSEPF/b2b/INPUT/CSEPF/*.txt /home/wasadm/tst/CSEPF/

The cp command here is not working and gives error :

[FINDEV1]/home/wasadm -> /usr/local/bin/sudo /usr/bin/cp /CSEPF/b2b/INPUT/CSEPF/*.txt /home/wasadm/tst/CSEPF/
cp: cannot access /CSEPF/b2b/INPUT/CSEPF/*.txt: No such file or directory

her's the visudo file entry for it :

 

Cmnd_Alias      CHNGPASSWD=/usr/bin/passwd
Cmnd_Alias      ENBLUSER=/usr/lbin/modprpw
Cmnd_Alias      ADMS=/sbin/set_parms date
Cmnd_Alias      CSEPF=/usr/bin/cd /CSEPF/b2b/INPUT
Cmnd_Alias      CHOWNCSE=/usr/bin/chown wasadm\:sftponly /home/wasadm/tst/*
Cmnd_Alias      CPCSE=/usr/bin/cp -R /CSEPF/b2b/INPUT/CSEPF/*.txt /home/wasadm/tst/CSEPF/
Cmnd_Alias      CPCSEC=/usr/bin/cp /CSEPF/b2b/INPUT/CSEPF/*.txt /home/wasadm/tst/CSEPF/      ##this one
Cmnd_Alias      CSELL=/home/wasadm/tst/CSEPF/CSEll.sh
#Cmnd_Alias      CHOWN=/usr/bin/chown wasadm:sftponly /home/wasadm/tst/
root            ALL=NOPASSWD:ALL
%sysadmin       ALL=NOPASSWD:ALL
%oper           ALL=NOPASSWD:ALL
wasadm ALL=(root) NOPASSWD: ADMS,ENBLUSER,CHNGPASSWD,CSEPF,CHOWN,CPCSE,CHOWNCSE,CSELL,CPCSEC
wasadm ALL=NOPASSWD: /home/wasadm/cpme.sh
wasadm ALL=NOPASSWD: /home/wasadm/chownme.sh

 

Also , the file does exist in the location

[root@findev1:/home/wasadm/tst/CSEPF]#ls -ld /CSEPF/b2b/INPUT/CSEPF/*.txt
-rw-r--r--   1 CSEPF      sftponly       260 Dec 16 12:42 /CSEPF/b2b/INPUT/CSEPF/EMC_ESRS_Details.txt
[root@findev1:/home/wasadm/tst/CSEPF]#

can't figure out what i am missing , i did tried something like :

/usr/local/bin/sudo /sbin/sh -c '/usr/bin/cp /CSEPF/b2b/INPUT/CSEPF/*.txt /home/wasadm/tst/CSEPF/'

din't worked either ,

 

BR,

RT

FrogIsDeaf
1 REPLY
Dennis Handly
Acclaimed Contributor
Solution

Re: sudo and wildcard expansion

>/usr/local/bin/sudo /usr/bin/cp /CSEPF/b2b/INPUT/CSEPF/*.txt /home/wasadm/tst/CSEPF/

 

If you don't have read permission with your original ID, you can't do filename expansion.

 

>/usr/local/bin/sudo /sbin/sh -c '/usr/bin/cp /CSEPF/b2b/INPUT/CSEPF/*.txt /home/wasadm/tst/CSEPF/'

 

Hmm, I would have thought that would work.  Provided you can execute that too.

And provided it is a local filesystem.