General discussion

Locked

script in UNIX

By dodik ·
I loged in as user:
user: tif , group: other ,

in terminal console I switched user: "su"
user: root group: other

Then I created a script: "move" -wrxwrxwrx
but when start this script "source move" I see message "Can't find move"

Why I can't run script under different user name
even if we are in same group?

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by Gary_W In reply to script in UNIX

i assume you created the 'move' script in the current directory. The current directory must not be in your search path when su'd to root. Test this by using the 'which' command, as in:
$ which move

You can always run it by forcing the shell to look in the current directory:
$ ./move

Note adding the current directory to your search path is dangerous and a security hole. A dubious person who gained access to your account could make a script with the same name as a standard utility like 'ls' and put it in your current directory. When you innocently typed 'ls', the dubious script could wreak some havoc, then call the real 'ls', then delete itself.

Gary

Collapse -

by dodik In reply to

It helped. Gary, thank you very much.

Collapse -

by ghislain.levesque In reply to script in UNIX

"." is not part of your default PATH. It's a security hole, but if you still want to do it, at least put it at the end of the PATH variable.
You should not write script with the same name as an unix command. Just to avoid confusion. You should create a directory like /usr/local/bin and put your script there and add it to the PATH.

You should never put 777 as permission for a script, that way anyone could modify your script, 750 or 755 is much better.

Collapse -

by dodik In reply to

It worked. Thank you very much

Collapse -

by dodik In reply to script in UNIX

This question was closed by the author

Back to Linux Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums