On 24/10/13 23:19, Ralf Mardorf wrote:
> Hi Scott,
> 
> On Thu, 2013-10-24 at 23:04 +1100, Scott Ferguson wrote:

<snipped>

> 
>> "su -c" isn't too difficult for many, and if the extra keystrokes are a
>> problem:-
>> $ echo "alias s='su -c"'" >> ~/.bash_aliases;. .bash rc


should have been:-
$ echo "alias s='su -c"'" >> ~/.bash_aliases;. .bashrc

(.bashrc is the filename, sourcing it makes the alias immediately active)

NOTE: the alias puts the first " into the command, all you need to do is
provide it later, bash will wait until you do. It's good like that.

>> then you can use "s" instead of "sudo" (or alias sudo='su -c"') if you
>> don't have sudo installed.
> 
> su -c becomes inconvenient if an option of a command needs quotation
> marks, the alias isn't helpful then.
> 
> su -c "command --option "that needs quotation marks""
> 
> Sure, it's not hard to correct this line, so that it will work, but it's
> not that handy as
> 
> sudo command --option "that needs quotation marks"
> 
> OTHO regarding to the amount of keystrokes
> 
> su -
> command_1
> command_n

If I want to run multiple commands I'd usually become root. su -c is for
single commands.  e.g.:-

scott@vbserver:~$ grep light .bash_aliases
alias light='su -c "service bluetooth stop;service apache2 stop;service
haveged stop;service openvpn stop;service pppd-dns stop;service
synce-hal-bluetooth stop;service unattended-upgrades stop;service
vboxautostart-service stop;service vboxballoonctrl-service stop;service
vboxdrv stop;service vboxweb-service stop;service virtualbox
stop;service x2goserver stop;service --status-all"'


> 
> is more pleasant than
> 
> sudo -i
> command_1
> command_n


I believe you are making life harder than it has to be :)  But, whatever
fills your pipe ;)

scott@vbserver:~$ grep "alias s=" .bash_aliases
alias s='su -c "'
scott@vbserver:~$ s apt-get install mc
> "            <- insert closing "
Password:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  arj dbview odt2txt gv catdvi djvulibre-bin python-boto python-tz
The following NEW packages will be installed:
  mc
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 472 kB of archives.
After this operation, 1,349 kB of additional disk space will be used.
Get:1 http://mirror.aarnet.edu.au/pub/debian/ wheezy/main mc i386
3:4.8.3-10 [472 kB]
Fetched 472 kB in 0s (2,107 kB/s)


2 keystrokes my method
How many with your method?  :)

> 
>> The price of convenience is often security.
> 
> There was a discussion about su vs sudo a while ago.

Yes. I still read it occasionally when I have trouble sleeping, or need
to remind myself that security is non-intuitive ;p

> 
> Regards,
> Ralf
> 
> 


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/526918e1.6050...@gmail.com

Reply via email to