Sponsored Content
Top Forums Shell Programming and Scripting SUID works for shell scripts?? Post 302952716 by MSK_1990 on Friday 21st of August 2015 07:14:45 AM
Old 08-21-2015
SUID works for shell scripts??

SUID works for shell scripts (bash)??

I'm user user1 need to execute a shell script (script.sh) which is owned by user2.
Code:
-rwsrwxrwx 1 user2 aduser 3518 Aug 21 05:33 script.sh

Only user2 has write privileges to write/copy a file in directory /dir1/subdir. Hence SUID bit permissions are set to that script.sh. But still not able to run the script from user1 account. It says permissions denied to /dir1/subdir.

But the same script (script.sh) runs successfully from user2 account and able to copy/write a file in /dir1/subdir.

I don't have any clue.. Please help me..

Last edited by rbatte1; 08-21-2015 at 09:17 AM.. Reason: Changed BOLD output to CODE
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

is SUID disabled for shell

Hi, I have two file in my directory. "catter" file contains "cat ./file". And "file" contails "Hi ashish". I have SUID bit set for catter file. But when a different user in my group runs file catter, shell displays "Permission denied" message. I just want to know can use of suid bit be... (3 Replies)
Discussion started by: shriashishpatil
3 Replies

2. Shell Programming and Scripting

substring command works but only in BASH shell

I am having trouble running a .sh file. The code 'x=${file_name:0:$z-11}' is giving me a bad substitution error. However when I run in BASH it works. Thing is when this goes to production the .sh will not be running in BASH. Is there a way to substring a string not in BASH or a way to invoke... (2 Replies)
Discussion started by: edwardtk11
2 Replies

3. Shell Programming and Scripting

Execution issue with shell script - works in a different environment

Hi I get the following error while executing the shell script. I did not get an error when I ran the script in a different environment (unix server). str-token.ksh: 0403-057 Syntax error at line 20 : `(' is not expected. This is the line which gives error string=(${pos_array}) Please find... (3 Replies)
Discussion started by: hidnana
3 Replies

4. Shell Programming and Scripting

Works in shell but not script UNIX

ok i have a very simple UNIX script #!/bin/bash TERM=ansi;export TERM PFCMARK=25;export PFCMARK umask 0000 PFUMASK=000;export PFUMASK #run for filepro menus and exectuables echo "###########File Modification Log.############\r" > "/public/appl-fp$(date +%m-%d-%Y).txt" find /appl/fp/... (10 Replies)
Discussion started by: dunpealslyr
10 Replies

5. Shell Programming and Scripting

how the typeset command works in shell script

typeset -l section section=${2:-.} what does these 2 lines meaning? (1 Reply)
Discussion started by: venkatababu
1 Replies

6. UNIX and Linux Applications

Rsync works in shell but not in cron

So I have this rsync script I wrote to grab some sql files and import them to a database. I left in the mysql stuff just give context to the situation. The real problem is with my rsync code. script.sh (chmod 744) #!/bin/sh rsync -av --rsh="sshpass -p'PASSWORD' ssh -l'USERNAME'"... (3 Replies)
Discussion started by: noPermissions
3 Replies

7. Shell Programming and Scripting

How does a if works in shell

Hi, I need to compare and get an output for values greater than "X10" (values contain both characters and numbers) using if loop... FOR EG: I want to export values greater than X10, i.e., in-case if the value is X11 and greater than the "if" part to be executed if the value is X9 and... (2 Replies)
Discussion started by: shivashankar_S
2 Replies

8. Shell Programming and Scripting

variable assigment not works in shell script

Hi, The following assigment is not working within shell script but is working from command line. Could anybody advise why? OS - solaris 8 APPL=`grep "$Application" ldapapps |awk '{print $1}'` echo $APPL (5 Replies)
Discussion started by: urello
5 Replies

9. Shell Programming and Scripting

perl: Command works in terminal, but not in shell script

Hi, the following command works in the terminal no problem. samtools view -h rawlib.bam | perl -ne '{ @line = split( /\s+/ ); $match = 0; while( $line =~ /(\d+)M/g ) { $match = $match + $1 } if( $match >= 80 || $_ =~ /^\@/ ) { print $_ } }' | java -Xmx12G -jar... (8 Replies)
Discussion started by: jdilts
8 Replies

10. UNIX for Dummies Questions & Answers

Difference between inbuilt suid programs and user defined root suid programs under bash shell?

Hey guys, Suppose i run passwd via bash shell. It is a suid program, which temporarily runs as root(owner) and modifies the user entries. However, when i write a C file and give 4755 permission and root ownership to the 'a.out' file , it doesn't run as root in bash shell. I verified this by... (2 Replies)
Discussion started by: syncmaster
2 Replies
KIBITZ(1)						      General Commands Manual							 KIBITZ(1)

NAME
kibitz - allow two people to interact with one shell SYNOPSIS
kibitz [ kibitz-args ] user [ program program-args... ] kibitz [ kibitz-args ] user@host [ program program-args... ] INTRODUCTION
kibitz allows two (or more) people to interact with one shell (or any arbitrary program). Uses include: o A novice user can ask an expert user for help. Using kibitz, the expert can see what the user is doing, and offer advice or show how to do it right. o By running kibitz and then starting a full-screen editor, people may carry out a conversation, retaining the ability to scroll backwards, save the entire conversation, or even edit it while in progress. o People can team up on games, document editing, or other cooperative tasks where each person has strengths and weaknesses that complement one another. USAGE
To start kibitz, user1 runs kibitz with the argument of the user to kibitz. For example: kibitz user2 kibitz starts a new shell (or another program, if given on the command line), while prompting user2 to run kibitz. If user2 runs kibitz as directed, the keystrokes of both users become the input of the shell. Similarly, both users receive the output from the shell. To terminate kibitz it suffices to terminate the shell itself. For example, if either user types ^D (and the shell accepts this to be EOF), the shell terminates followed by kibitz. Normally, all characters are passed uninterpreted. However, if the escape character (described when kibitz starts) is issued, the user may talk directly to the kibitz interpreter. Any Expect(1) or Tcl(3) commands may be given. Also, job control may be used while in the inter- preter, to, for example, suspend or restart kibitz. Various processes can provide various effects. For example, you can emulate a two-way write(1) session with the command: kibitz user2 sleep 1000000 ARGUMENTS
kibitz takes arguments, these should also be separated by whitespace. The -noproc flag runs kibitz with no process underneath. Characters are passed to the other kibitz. This is particularly useful for con- necting multiple interactive processes together. In this mode, characters are not echoed back to the typist. -noescape disables the escape character. -escape char sets the escape character. The default escape character is ^]. -silent turns off informational messages describing what kibitz is doing to initiate a connection. -tty ttyname defines the tty to which the invitation should be sent. If you start kibitz to user2 on a remote computer, kibitz performs a rlogin to the remote computer with your current username. The flag -proxy username causes rlogin to use username for the remote login (e.g. if your account on the remote computer has a different username). If the -proxy flag is not given, kibitz tries to determine your current username by (in that order) inspecting the environment variables USER and LOGNAME, then by using the commands whoami and logname. The arguments -noescape and -escape can also be given by user2 when prompted to run kibitz. MORE THAN TWO USERS
The current implementation of kibitz explicitly understands only two users, however, it is nonetheless possible to have a three (or more) -way kibitz, by kibitzing another kibitz. For example, the following command runs kibitz with the current user, user2, and user3: % kibitz user2 kibitz user3 Additional users may be added by simply appending more "kibitz user" commands. The xkibitz script is similar to kibitz but supports the ability to add additional users (and drop them) dynamically. CAVEATS
kibitz assumes the 2nd user has the same terminal type and size as the 1st user. If this assumption is incorrect, graphical programs may display oddly. kibitz handles character graphics, but cannot handle bitmapped graphics. Thus, % xterm -e kibitz will work % kibitz xterm will not work However, you can get the effect of the latter command by using xkibitz (see SEE ALSO below). kibitz uses the same permissions as used by rlogin, rsh, etc. Thus, you can only kibitz to users at hosts for which you can rlogin. Similarly, kibitz will prompt for a password on the remote host if rlogin would. If you kibitz to users at remote hosts, kibitz needs to distinguish your prompt from other things that may precede it during login. (Ide- ally, the end of it is preferred but any part should suffice.) If you have an unusual prompt, set the environment variable EXPECT_PROMPT to an egrep(1)-style regular expression. Brackets should be preceded with one backslash in ranges, and three backslashes for literal brackets. The default prompt r.e. is "($|%|#) ". kibitz requires the kibitz program on both hosts. kibitz requires expect(1). By comparison, the xkibitz script uses the X authorization mechanism for inter-host communication so it does not need to login, recognize your prompt, or require kibitz on the remote host. It does however need permission to access the other X servers. BUGS
An early version of Sun's tmpfs had a bug in it that causes kibitz to blow up. If kibitz reports "error flushing ...: Is a directory" ask Sun for patch #100174. If your Expect is not compiled with multiple-process support (i.e., you do not have a working select or poll), you will not be able to run kibitz. ENVIRONMENT
The environment variable SHELL is used to determine the shell to start, if no other program is given on the command line. If the environment variable EXPECT_PROMPT exists, it is taken as a regular expression which matches the end of your login prompt (but does not otherwise occur while logging in). See also CAVEATS above. If the environment variables USER or LOGNAME are defined, they are used to determine the current user name for a kibitz to a remote com- puter. See description of the -proxy option in ARGUMENTS above. SEE ALSO
Tcl(3), libexpect(3), xkibitz(1) "Exploring Expect: A Tcl-Based Toolkit for Automating Interactive Programs" by Don Libes, O'Reilly and Associates, January 1995. "Kibitz - Connecting Multiple Interactive Programs Together", by Don Libes, Software - Practice & Experience, John Wiley & Sons, West Sus- sex, England, Vol. 23, No. 5, May, 1993. AUTHOR
Don Libes, National Institute of Standards and Technology kibitz is in the public domain. NIST and I would appreciate credit if this program or parts of it are used. 19 October 1994 KIBITZ(1)
All times are GMT -4. The time now is 04:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy