I was reading the following code:
$ sudo bash
# cd /home/
# ./gitpull.sh
Why do I need the first line, what does it do exactly? What if I just did $ sudo instead of $ sudo bash ?
|
it starts a bash shell as a root level user. You need it because typically normal users can't access the danger of what you are doing is you are in a root shell -- you can mess up your machine morez easilyz |
|||||
|
|
You would be much better off doing:
Because the commands invoked as root will be logged. Invoking a shell directly through sudo avoids all of the security benefits of sudo and should be avoided. |
|||
|
|
|
|
|||
|
|
|
I'm betting
Also @nisdis is right. Plain old |
|||
|
|
|
The infamous sudo is an acronym of sorts for Superuser Do. It basically make a normal user a Super user for a short while. In your command sudo bash , effectively you are saying Superuser do --> a Bourne shell ( bash ) Which opens a root user logged in shell. If you just ran sudo the operating system wouldn't know what to do. So in general sudo is followed by a unix command. |
||||
|
|
|
If If an attacker obtains the password of any one of the accounts which are able to do The proper way to do the equivalent of |
|||||||||||||||
|
man sudo, b)sudoreturns usage information c)man bashexplains the$and#shown in section PROMPTING. – Daniel Beck♦ Apr 27 '12 at 5:07