From: "Bill C Riemers" <docbill@freeshell.org>
To: <cygwin@cygwin.com>
Subject: Re: cron
Date: Fri, 09 May 2003 01:37:00 -0000 [thread overview]
Message-ID: <008801c315cb$8f7f60e0$c800a8c0@docbill> (raw)
[-- Attachment #1: Type: text/plain, Size: 926 bytes --]
Coronna,
That is exactly what I did when I realized the UID trick doesn't work under cygwin. In fact I wrote myself a short script
as "/usr/local/bin/su" to use in place of "/usr/bin/su". Like most scripts I write I found I really don't use it. I just
keep it around incase something I download includes a script or a Makefile that requires a working version of su.
Bill
> That's way easier:
>
> Add a home dir and a useful shell to SYSTEM's /etc/passwd entry:
>
> SYSTEM:*:18:544:,S-1-5-18:/home/system:/bin/bash
>
> Then: Install sshd as service, create a private/public key pair, put
> the public key into /home/system/.ssh/authorized_keys and login to your
> system using `ssh -l system localhost'.
>
>
> Or: Install inetd as service, remove the `*' from SYSTEM's password
> field and login to localhost using rlogin or telnet.
>
> Corinna
>
> -
>
[-- Attachment #2: su --]
[-- Type: application/octet-stream, Size: 3639 bytes --]
#!/usr/bin/bash
# assign the environment to a
a=`env |sed -n -e '/^!::=/d' -e 's,$,_EOL_,g' -e 's,'\'',_APOS_,g' -e 's/\([A-Za-z0-9_][A-Za-z0-9_]*\)=/'\'';\1='\''/' -e '/./p'`
rm -f /tmp/env.$$
echo "#!`which bash`" > /tmp/env.$$
chmod 755 /tmp/env.$$
userarg="Administrator"
options=":lc:fmps:"
repeat=1;
while [ $repeat -ne 0 ] ; do
getopts $options arg
if [ $? -ne 0 ] ; then
arg="$1"
OPTIND=2
fi
case "x$arg" in
xl | x- | x--login)
loginarg=1
if [ -z "$shellarg" ] ; then
shellarg=`which bash`
fi
;;
xc | x--command | x--command)
commandarg="$OPTARG"
;;
x--command=*)
commandarg="${arg##--command=}"
;;
xf | x--fast )
fastarg=1
if [ -z "$shellarg" ] ; then
shellarg=`which tcsh`
fi
if [ -z "$shellarg" ] ; then
shellarg=`which csh`
fi
;;
xm | xp | x--preserve-environment)
echo $a|sed -e 's,^'\'';,,' -e 's,_EOL_$,'\'',' -e 's,_EOL_ '\'';,'\'';\
,g' -e "s,_APOS_,'\\'',g" -e 's,_EOL_ ,\
,g' >> /tmp/env.$$
env|sed -n -e 's,\([A-Za-z0-9_][A-Za-z0-9_]*\)=.*,export \1;,p' >> /tmp/env.$$
preservearg=1
;;
xs )
shellarg="$OPTARG"
;;
x--shell)
shellarg="$OPTARG"
OPTIND=3
;;
x--shell=*)
shellarg="${arg##--shell=}"
;;
*)
repeat=0
OPTIND=1
;;
esac
while [ $OPTIND -gt 1 ] ; do
shift
OPTIND=`expr $OPTIND - 1`
done
done
if [ -n "$1" ] ; then
userarg="$1"
shift
fi
if [ -z "$shellarg" ] ; then
shellarg=`which bash`
fi
if [ -n "$commandarg" ] ; then
echo "exec \"$shellarg\" $fastarg $loginarg -c \"$commandarg\"" >>/tmp/env.$$
elif [ -n "$*" ] ; then
echo "exec \"$shellarg\" $fastarg $loginarg -c \"$@\"" >>/tmp/env.$$
else
echo "exec \"$shellarg\" $fastarg $loginarg -i -s" >>/tmp/env.$$
fi
trap "rm -f /tmp/env.$$" EXIT
ssh -l "$userarg" localhost /tmp/env.$$
exit $?
SU(1) User Commands SU(1)
NAME
su - run a shell with substitute user and group IDs
SYNOPSIS
su [OPTION]... [-] [USER [ARG]...]
DESCRIPTION
Change the effective user id and group id to that of USER.
-, -l, --login
make the shell a login shell
-c, --commmand=COMMAND
pass a single COMMAND to the shell with -c
-f, --fast
pass -f to the shell (for csh or tcsh)
-m, --preserve-environment
do not reset environment variables
-p same as -m
-s, --shell=SHELL
run SHELL if /etc/shells allows it
--help display this help and exit
--version
output version information and exit
A mere - implies -l. If USER not given, assume root.
AUTHOR
Written by David MacKenzie.
REPORTING BUGS
Report bugs to <bug-sh-utils@gnu.org>.
COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
SEE ALSO
The full documentation for su is maintained as a Texinfo manual. If
the info and su programs are properly installed at your site, the com-
mand
info su
should give you access to the complete manual.
su (sh-utils) 2.0.15 August 2002 SU(1)
[-- Attachment #3: Type: text/plain, Size: 218 bytes --]
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
next reply other threads:[~2003-05-09 1:37 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-09 1:37 Bill C Riemers [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-01-10 21:27 cron Rolf Schlagenhaft
2012-01-10 21:46 ` cron Larry Hall (Cygwin)
2012-01-10 23:45 ` cron Rolf Schlagenhaft
2011-08-24 16:09 cron mramakishore
2011-08-24 16:58 ` cron Larry Hall (Cygwin)
2011-08-28 10:50 ` cron kishore
2011-08-31 18:07 ` cron Larry Hall (Cygwin)
2009-09-16 7:51 cron Μηχανογράφηση ΔΔΕ Α΄ Αθήνας
2009-09-16 16:15 ` cron Pierre A. Humblet
2008-05-15 3:13 cron Marc Kirby
2008-05-15 16:27 ` cron Pierre A. Humblet
2007-12-19 18:59 cron Bruno Zovich
2007-12-19 20:51 ` cron Pierre A. Humblet
2007-09-12 14:40 cron Alexander Polson
2007-09-12 14:58 ` cron Larry Hall (Cygwin)
2007-09-13 5:26 ` cron Pierre A. Humblet
2007-09-13 6:00 ` cron René Berber
2007-09-13 15:35 ` cron Pierre A. Humblet
2007-09-13 18:25 ` cron Larry Hall (Cygwin)
2007-08-31 15:25 cron Barry Benowitz
2007-08-31 15:50 ` cron Larry Hall (Cygwin)
2007-08-31 16:34 ` cron Pierre A. Humblet
2007-08-08 14:50 cron Kiran, Shashi
2007-08-08 16:26 ` cron Pierre A. Humblet
2007-08-09 9:44 ` cron shash
2007-04-12 16:07 cron Gary Worthy
2007-04-12 16:15 ` cron Dave Korn
2004-05-11 22:11 cron Jimmy Hayes
[not found] ` <75EA21FE420C864D895DE6E87383D6A157EA41@exchange1.meddatahc s.com>
2004-05-11 23:11 ` cron Larry Hall
2003-04-01 17:27 cron! Igor Pechtchanski
2003-04-01 17:32 ` cron adam r. christopher
2003-04-01 17:42 ` cron Igor Pechtchanski
2003-04-01 17:45 ` cron Igor Pechtchanski
2003-04-01 18:37 ` cron Thorsten Kampe
2002-01-07 2:30 cron Facey Brian
2002-01-07 3:46 ` cron Gerrit P. Haase
2001-07-13 13:08 cron David G. Baur
2001-07-13 13:12 ` cron Gerrit P. Haase
2001-06-20 19:32 Cron Bob Zimmerman
2001-06-21 2:22 ` Cron Michael Schaap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='008801c315cb$8f7f60e0$c800a8c0@docbill' \
--to=docbill@freeshell.org \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).