[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] user root
From: |
Jeff Forcier |
Subject: |
Re: [Fab-user] user root |
Date: |
Wed, 18 Apr 2012 11:07:48 -0700 |
Hi Fabien,
Please see the FAQ for why "su" doesn't work as you expect:
http://docs.fabfile.org/en/1.4.1/faq.html#my-cd-workon-export-etc-calls-don-t-seem-to-work
To do things with root privileges, you must be able to modify your
sudoers config so these other users can use sudo, or log in as a
sudo-capable user, or things simply aren't going to go easily for you
:)
-Jeff
On Wed, Apr 18, 2012 at 8:27 AM, Fabien Murgues
<address@hidden> wrote:
> Hello,
>
> I want to create a script to update (aptitude update ; aptitude upgrade)
> Linux machines (Ubuntu and Debian).
> I have succeed for the machines with a sudo account but i have a problem
> with accounts without sudo rights (typically on debian, a user and a root).
> With a run("su -") a password was asked and i don't know where i could
> put the root account/password :
>
> My version with sudo :
>
> from fabric.api import run,env,sudo
>
> env.roledefs = {
> 'test1' : ['address@hidden'],
> 'test2' : [ 'address@hidden'],
> 'all' : [ 'address@hidden', 'address@hidden'],
> }
>
> env.passwords = {'address@hidden': 'mypwd1', 'address@hidden':
> 'mypwd2scd2011SCD$', 'address@hidden': 'myrootpwd'}
> ---------------------------------------------
> OK if user2 has sudo
> ---------------------------------------------
> def maj():
> sudo("aptitude update; aptitude safe-upgrade")
>
> ---------------------------------------------
> NOT OK with root
> ---------------------------------------------
> def maj():
> run("su -")
>
>
> Thanks by advance
>
> --
>
>
> Cordialement,
> Fabien Murgues
>
> Service Commun Documentation Saint Etienne
> Informatique
> 23 rue Docteur Paul Michelon
> 42023 Saint Etienne Cedex 2
>
> tél : 04 77 48 15 92
> fax : 04 77 48 15 91
>
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/fab-user
>
--
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org