Securing arguments


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Securing arguments
# 1  
Old 05-21-2004
Tools Securing arguments

OK here is my problem. Ive been trying to write a script where i use the order "find".

For example if i wont to find some file in the sql_work directory using the script. You use the command: loc sql_work "q*" in order to find all the queries in the directory.
Is there any other way to do it, like for example: loc sql_work q* without using the " " which secure the argument from the shell?

Here is the script:

#! /bin/csh
if($#argv == 0) then
echo Usage is $0 path filename
echo or $0 filename
exit 1
endif
if($#argv == 1) then
foreach arg($argv)
set tmp = `find ~ -name "$arg"` >& /dev/null
if("$tmp" != "") then
echo $tmp
else
echo No files matching name "$argv[1]"
exit 1
endif
end
exit 0
endif
if($#argv == 2) then
if(! -e "$argv[1]") then
echo "$argv[1]" not valid directory
exit 2
endif
set tmp = `find ~/"$argv[1]" -name "$argv[2]"` >& /dev/null
if("$tmp" != "") then
echo $tmp
else
echo No files matching name "$argv[2]"
exit 1
endif
exit 0

endif



Thank you in advance!!!Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. AIX

Securing AIX

Guys, i want to securing AIX after install by scratch. Is anybody can inform about the standard port which used by AIX? (4 Replies)
Discussion started by: michlix
4 Replies

2. Cybersecurity

securing AIX box

Guys, i want to securing AIX after install by scrath. Is anybody can inform about the standard port which used by AIX? (0 Replies)
Discussion started by: michlix
0 Replies

3. Linux

Securing remote connections

Hi all, I have a couple of questions I've been searching on internet but I didn't find a suitable solution. The aim is that I'd like to access to my home Linux (an 8.04 Ubuntu) from outside. I already achieved with ssh, but I'd like to secure as much as I can. These are questions: The... (2 Replies)
Discussion started by: AlbertGM
2 Replies

4. Cybersecurity

Securing Passwords

Hi All, I'd like to give you an example of what I am trying to achieve and perhaps you might be able to help me along. I would like to add the following criteria to new servers, from a password aging and lockout standpoint. -Number of failed logins before lockout: = 5 -Number of Passwords... (1 Reply)
Discussion started by: mkono
1 Replies

5. AIX

securing a shell

I would like to secure a shell script from being broken out of with Ctrl-C or equivalent. Once a user logs in, he should not be able to exit to the command prompt. any ideas. Thank you J (1 Reply)
Discussion started by: jhansrod
1 Replies

6. Cybersecurity

securing a remote box

someone has access to my server... I've got a solaris 7 box with remote access only. many of the services don't have passwords and someone recently messed with the shadow file -the root: line was changed: . password field was changed to NP . the number after that was changed too The... (8 Replies)
Discussion started by: sphiengollie
8 Replies
Login or Register to Ask a Question
SETUID(1)						      General Commands Manual							 SETUID(1)

NAME
setuid - run a command with a different uid. SYNOPSIS
setuid username|uid command [ args ] DESCRIPTION
Setuid changes user id, then executes the specified command. Unlike some versions of su(1), this program doesn't ever ask for a password when executed with effective uid=root. This program doesn't change the environment; it only changes the uid and then uses execvp() to find the command in the path, and execute it. (If the command is a script, execvp() passes the command name to /bin/sh for processing.) For example, setuid some_user $SHELL can be used to start a shell running as another user. Setuid is useful inside scripts that are being run by a setuid-root user -- such as a script invoked with super, so that the script can execute some commands using the uid of the original user, instead of root. This allows unsafe commands (such as editors and pagers) to be used in a non-root mode inside a super script. For example, an operator with permission to modify a certain protected_file could use a super command that simply does: cp protected_file temp_file setuid $ORIG_USER ${EDITOR:-/bin/vi} temp_file cp temp_file protected_file (Note: don't use this example directly. If the temp_file can somehow be replaced by another user, as might be the case if it's kept in a temporary directory, there will be a race condition in the time between editing the temporary file and copying it back to the protected file.) AUTHOR
Will Deich local SETUID(1)