* Script as root
@ 2002-10-01 13:55 Paul Kraus
2002-10-01 14:23 ` Paul Furness
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Paul Kraus @ 2002-10-01 13:55 UTC (permalink / raw)
To: linux-newbie
[-- Attachment #1: Type: text/plain, Size: 282 bytes --]
I have a backup script that mounts a drive on my xp workstations. Is
there a way I can set this script to run as root so that I do not have
to su every time I want to run it?
Paul Kraus
Network Administrator
PEL Supply Company
216.267.5775 Voice
216-267-6176 Fax
www.pelsupply.com
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Paul Kraus (pkraus@pelsupply.com).vcf --]
[-- Type: text/x-vcard; name="Paul Kraus (pkraus@pelsupply.com).vcf", Size: 592 bytes --]
BEGIN:VCARD
VERSION:2.1
N:Kraus;Paul
FN:Paul Kraus (pkraus@pelsupply.com)
ORG:PEL Supply Company
TITLE:Network Administrator
TEL;WORK;VOICE:(216) 267-5775
TEL;CELL;VOICE:(216) 410-5526
TEL;WORK;FAX:(216) 267-6176
ADR;WORK:;;4666 Manufacturing Road;Cleveland;Ohio;44135;United States of America
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:4666 Manufacturing Road=0D=0ACleveland, Ohio 44135=0D=0AUnited States of Ame=
rica
ADR;HOME:;;;;;;United States
LABEL;HOME:United States
URL;WORK:http://www.pelsupply.com
EMAIL;PREF;INTERNET:pkraus@pelsupply.com
REV:20020416T182124Z
END:VCARD
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Script as root
2002-10-01 13:55 Script as root Paul Kraus
@ 2002-10-01 14:23 ` Paul Furness
2002-10-01 14:57 ` File in use Samba ( was Script as root) Paul Kraus
2002-10-01 14:24 ` Script as root szonyi calin
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Paul Furness @ 2002-10-01 14:23 UTC (permalink / raw)
To: Paul Kraus; +Cc: linux-newbie
There are a couple of ways, depending on how you are mounting the drive.
Dirty way:
If you are using NFS and are _not_ using an auto mounter of some kind
(amd, autofs), change the ownership of the script file to root, then
setUID on it. like this:
chown root SCRIPT
chmod +s SCRIPT
Note: Using SUID is not particularly secure. It's usually ok in a
trusted environment, but if a hacker could get anywhere near your linux
machine DON'T DO IT THIS WAY. In that case, look at using amd or autofs.
Cleaner way:
Presumably you are using SAMBA to mount the drive from your XP box. In
which case, you don't need to be root, provided that the mount point is
owned by the user. For example, as user paulk, you could create a
directory to use for the mount (mkdir ~/windows) and then you should be
able to mount the samba share as the user with:
smbmnt //machine/sharename ~/windows -o username=XPUSER,password=XPPASS
and later on unmount it with:
smbumount ~/windows
However, for this to work, smbmnt and smbumount must be suid. Assuming
you have a standard setup, you can do that like this (as root):
chmod +s /usr/bin/smbmnt /usr/bin/smbumount
Note: This is fairly safe to do; smbmnt and smbumount are designed to be
run this way.
Paul.
On Tue, 2002-10-01 at 14:55, Paul Kraus wrote:
> I have a backup script that mounts a drive on my xp workstations. Is
> there a way I can set this script to run as root so that I do not have
> to su every time I want to run it?
>
> Paul Kraus
> Network Administrator
> PEL Supply Company
> 216.267.5775 Voice
> 216-267-6176 Fax
> www.pelsupply.com
--
Paul Furness
Systems Manager
2+2=5 for extremely large values of 2.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Script as root
2002-10-01 13:55 Script as root Paul Kraus
2002-10-01 14:23 ` Paul Furness
@ 2002-10-01 14:24 ` szonyi calin
2002-10-01 14:38 ` pa3gcu
2002-10-01 15:52 ` Ray Olszewski
3 siblings, 0 replies; 9+ messages in thread
From: szonyi calin @ 2002-10-01 14:24 UTC (permalink / raw)
To: Paul Kraus, linux-newbie
--- Paul Kraus <pkraus@pelsupply.com> a écrit : > I
have a backup script that mounts a drive on my xp
> workstations. Is
> there a way I can set this script to run as root so
> that I do not have
> to su every time I want to run it?
>
sudo is used for running commands as a different user.
man sudo
If you want the script to run regullarly you can use
cron.
man crond
man crontab
Pay attention to the EDITOR variable in your shell
because this editor is used to edit crontab
You can mount your partition as user.
man fstab
Bye
Calin
> Paul Kraus
> Network Administrator
> PEL Supply Company
> 216.267.5775 Voice
> 216-267-6176 Fax
> www.pelsupply.com
> > BEGIN:VCARD
> VERSION:2.1
> N:Kraus;Paul
> FN:Paul Kraus (pkraus@pelsupply.com)
> ORG:PEL Supply Company
> TITLE:Network Administrator
> TEL;WORK;VOICE:(216) 267-5775
> TEL;CELL;VOICE:(216) 410-5526
> TEL;WORK;FAX:(216) 267-6176
> ADR;WORK:;;4666 Manufacturing
> Road;Cleveland;Ohio;44135;United States of America
> LABEL;WORK;ENCODING=QUOTED-PRINTABLE:4666
> Manufacturing Road=0D=0ACleveland, Ohio
> 44135=0D=0AUnited States of Ame=
> rica
> ADR;HOME:;;;;;;United States
> LABEL;HOME:United States
> URL;WORK:http://www.pelsupply.com
> EMAIL;PREF;INTERNET:pkraus@pelsupply.com
> REV:20020416T182124Z
> END:VCARD
>
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Script as root
2002-10-01 13:55 Script as root Paul Kraus
2002-10-01 14:23 ` Paul Furness
2002-10-01 14:24 ` Script as root szonyi calin
@ 2002-10-01 14:38 ` pa3gcu
2002-10-01 15:52 ` Ray Olszewski
3 siblings, 0 replies; 9+ messages in thread
From: pa3gcu @ 2002-10-01 14:38 UTC (permalink / raw)
To: Paul Kraus, linux-newbie
On Tuesday 01 October 2002 13:55, Paul Kraus wrote:
> I have a backup script that mounts a drive on my xp workstations. Is
> there a way I can set this script to run as root so that I do not have
> to su every time I want to run it?
You could automate the process via crond. As root;
crontab -e
add a line for your script an example;
10 6 * * */home/pa3gcu/scripts/own-work/dynipcheck
'man crontab' shows more examples.
>
> Paul Kraus
> Network Administrator
> PEL Supply Company
> 216.267.5775 Voice
> 216-267-6176 Fax
> www.pelsupply.com
--
Regards Richard
pa3gcu@zeelandnet.nl
http://people.zeelandnet.nl/pa3gcu/
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: File in use Samba ( was Script as root)
2002-10-01 14:23 ` Paul Furness
@ 2002-10-01 14:57 ` Paul Kraus
2002-10-01 16:12 ` Ray Olszewski
0 siblings, 1 reply; 9+ messages in thread
From: Paul Kraus @ 2002-10-01 14:57 UTC (permalink / raw)
To: 'Paul Furness', linux-newbie
I have written the script to tar up folders on my xp box. The script
works. I mount -t smbfs .... The folder I want. I then tar mnt/folder
The problem is that I get errors saying that the file changed as we read
it. Or text file busy.
None of the files are in use. Nor are they system files of any kind. I
know for a fact that the xp system is not using them. Any ideas as to
what may be causing this?
I am smbmounting the drive rather then using smbtar due to the
limitations of smbtar.
My script tars up a folder and the dumps the output to a text file. The
script does this for about 4 different folders. It then tars the
tarballs together into one file with the "index" text files also tarred
up. It is then compresses using bzip2. The work files are deleted.
Paul
-----Original Message-----
From: Paul Furness [mailto:paul.furness@vil.ite.mee.com]
Sent: Tuesday, October 01, 2002 10:24 AM
To: Paul Kraus
Cc: linux-newbie@vger.kernel.org
Subject: Re: Script as root
There are a couple of ways, depending on how you are mounting the drive.
Dirty way:
If you are using NFS and are _not_ using an auto mounter of some kind
(amd, autofs), change the ownership of the script file to root, then
setUID on it. like this:
chown root SCRIPT
chmod +s SCRIPT
Note: Using SUID is not particularly secure. It's usually ok in a
trusted environment, but if a hacker could get anywhere near your linux
machine DON'T DO IT THIS WAY. In that case, look at using amd or autofs.
Cleaner way:
Presumably you are using SAMBA to mount the drive from your XP box. In
which case, you don't need to be root, provided that the mount point is
owned by the user. For example, as user paulk, you could create a
directory to use for the mount (mkdir ~/windows) and then you should be
able to mount the samba share as the user with:
smbmnt //machine/sharename ~/windows -o username=XPUSER,password=XPPASS
and later on unmount it with:
smbumount ~/windows
However, for this to work, smbmnt and smbumount must be suid. Assuming
you have a standard setup, you can do that like this (as root):
chmod +s /usr/bin/smbmnt /usr/bin/smbumount
Note: This is fairly safe to do; smbmnt and smbumount are designed to be
run this way.
Paul.
On Tue, 2002-10-01 at 14:55, Paul Kraus wrote:
> I have a backup script that mounts a drive on my xp workstations. Is
> there a way I can set this script to run as root so that I do not have
> to su every time I want to run it?
>
> Paul Kraus
> Network Administrator
> PEL Supply Company
> 216.267.5775 Voice
> 216-267-6176 Fax
> www.pelsupply.com
--
Paul Furness
Systems Manager
2+2=5 for extremely large values of 2.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Script as root
2002-10-01 13:55 Script as root Paul Kraus
` (2 preceding siblings ...)
2002-10-01 14:38 ` pa3gcu
@ 2002-10-01 15:52 ` Ray Olszewski
2002-10-01 16:11 ` Jim Reimer
3 siblings, 1 reply; 9+ messages in thread
From: Ray Olszewski @ 2002-10-01 15:52 UTC (permalink / raw)
To: Paul Kraus, linux-newbie
Yes. You want to set the suid bit on it and have it owned by root. "man
chmod" (or maybe other chmod documentation) for the details.
At 09:55 AM 10/1/02 -0400, Paul Kraus wrote:
>I have a backup script that mounts a drive on my xp workstations. Is
>there a way I can set this script to run as root so that I do not have
>to su every time I want to run it?
--
-------------------------------------------"Never tell me the odds!"--------
Ray Olszewski -- Han Solo
Palo Alto, California, USA ray@comarre.com
-------------------------------------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Script as root
2002-10-01 15:52 ` Ray Olszewski
@ 2002-10-01 16:11 ` Jim Reimer
2002-10-01 21:10 ` pa3gcu
0 siblings, 1 reply; 9+ messages in thread
From: Jim Reimer @ 2002-10-01 16:11 UTC (permalink / raw)
To: Ray Olszewski; +Cc: linux-newbie
suid bit on a script is ignored, isn't it?
-jdr-
Ray Olszewski wrote:
> Yes. You want to set the suid bit on it and have it owned by root. "man
> chmod" (or maybe other chmod documentation) for the details.
>
> At 09:55 AM 10/1/02 -0400, Paul Kraus wrote:
>
>> I have a backup script that mounts a drive on my xp workstations. Is
>> there a way I can set this script to run as root so that I do not have
>> to su every time I want to run it?
>
>
>
>
> --
> -------------------------------------------"Never tell me the
> odds!"--------
> Ray Olszewski -- Han Solo
> Palo Alto, California, USA ray@comarre.com
> -------------------------------------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: File in use Samba ( was Script as root)
2002-10-01 14:57 ` File in use Samba ( was Script as root) Paul Kraus
@ 2002-10-01 16:12 ` Ray Olszewski
0 siblings, 0 replies; 9+ messages in thread
From: Ray Olszewski @ 2002-10-01 16:12 UTC (permalink / raw)
To: Paul Kraus, linux-newbie
At 10:57 AM 10/1/02 -0400, Paul Kraus wrote:
>I have written the script to tar up folders on my xp box. The script
>works. I mount -t smbfs .... The folder I want. I then tar mnt/folder
>The problem is that I get errors saying that the file changed as we read
>it. Or text file busy.
>None of the files are in use. Nor are they system files of any kind. I
>know for a fact that the xp system is not using them. Any ideas as to
>what may be causing this?
The only idea this description suggests to me is that the file in question
was recently changed and buffered on the XP system, and the "change" tar
detects is the result of the XP system sync'ing (or its Windows equivalent)
the hard drive to the buffer. But this is fishing in a cloudy pond. Could
you repost with a small snippet that reports the actual message tar (or
smbd or mountd or whatever is giving you the error) posts for each of the
two errors?
--
-------------------------------------------"Never tell me the odds!"--------
Ray Olszewski -- Han Solo
Palo Alto, California, USA ray@comarre.com
-------------------------------------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Script as root
2002-10-01 16:11 ` Jim Reimer
@ 2002-10-01 21:10 ` pa3gcu
0 siblings, 0 replies; 9+ messages in thread
From: pa3gcu @ 2002-10-01 21:10 UTC (permalink / raw)
To: Jim Reimer, Ray Olszewski; +Cc: linux-newbie
On Tuesday 01 October 2002 16:11, Jim Reimer wrote:
> suid bit on a script is ignored, isn't it?
AFAIK yes, and the saying is, never run a script as root, root is evil, one
small oversight and damage can be done period.
I once was accused of destorying someones system because i said, "if" you
want to get all the information from the script then you will need to run it
as root, if it is run under a user it will not gain some vital information
from your /etc dir, a few days later a mail appierd on that particular
mailing list saying i had destroyed his system with my script.
Many still use that script actually but thats asside the point, root is evil.
> -jdr-
>
> Ray Olszewski wrote:
> > Yes. You want to set the suid bit on it and have it owned by root. "man
> > chmod" (or maybe other chmod documentation) for the details.
> >
> > At 09:55 AM 10/1/02 -0400, Paul Kraus wrote:
> >> I have a backup script that mounts a drive on my xp workstations. Is
> >> there a way I can set this script to run as root so that I do not have
> >> to su every time I want to run it?
> >
> > --
> > -------------------------------------------"Never tell me the
> > odds!"--------
> > Ray Olszewski -- Han Solo
> > Palo Alto, California, USA ray@comarre.com
> > -------------------------------------------------------------------------
> >------
--
Regards Richard
pa3gcu@zeelandnet.nl
http://people.zeelandnet.nl/pa3gcu/
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2002-10-01 21:10 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-01 13:55 Script as root Paul Kraus
2002-10-01 14:23 ` Paul Furness
2002-10-01 14:57 ` File in use Samba ( was Script as root) Paul Kraus
2002-10-01 16:12 ` Ray Olszewski
2002-10-01 14:24 ` Script as root szonyi calin
2002-10-01 14:38 ` pa3gcu
2002-10-01 15:52 ` Ray Olszewski
2002-10-01 16:11 ` Jim Reimer
2002-10-01 21:10 ` pa3gcu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.