2

The abstract question is:

If script x calls program y, do I need a NOPASSWD entry in /etc/sudoers for x, y or both x & y? (And can x then call sudo -v without a password?)

Details:

I'm trying to figure out what should go into the /etc/sudoers file to allow a user on Ubuntu (i.e., user ID 1000 who has sudo privileges) to execute a pre-configured full backup without entering a password.

My backup script is: /usr/local/bin/backup
(See below for script.)

The actual backup program called by my script is /opt/storeBackup/bin/storeBackup.pl
(See http://storebackup.org/)

I tried several approaches with visudo but regardless of what I tried, I was still prompted for the password when running the script.

I expected that adding a final line to /etc/sudoers (using visudo) like the following would work:

myuser ALL=(ALL) NOPASSWORD:/usr/local/bin/backup

That didn't work. Neither did this:

myuser ALL=(ALL) NOPASSWORD:/usr/local/bin/backup, /opt/storeBackup/bin/storeBackup.pl

Is the problem due to my script calling sudo -v near the beginning? Or is something else the problem?

To execute the following script, I expect the user to open a terminal and type backup. I want it to be that simple and I don't want them to be prompted for a password at all.

#!/bin/bash

sudo -v
# Keep-alive: update existing sudo time stamp if set, otherwise do nothing.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &

#do a bunch of stuff that could take a while...

#finally, do backup without asking for password:
sudo /opt/storeBackup/bin/storeBackup.pl -f backup.conf

Thanks

  • Have you tried removing everything except for the last line? You haven't given your user permission to run true with no password and those lines are completely unnecessary anyways. – jordanm Mar 18 '14 at 5:30
2

I was successful in using the following examples as you've described. Sample scripts:

top.bash
$ cat /tmp/top.bash    
#!/bin/bash

echo "running $0"
sudo -v 
whoami
sudo /tmp/bott.bash
bott.bash
$ more /tmp/bott.bash
#!/bin/bash

echo "running $0"
whoami

Now with the following modification to sudo:

## Allow root to run any commands anywhere 
root    ALL=(ALL)       ALL
sam     ALL=(ALL)       NOPASSWD:/tmp/top.bash

Now as user sam:

$ sudo /tmp/top.bash 
running /tmp/top.bash
root
running /tmp/bott.bash
root

What about running top.bash without sudo?

If I alter the /etc/sudoers file like so:

sam     ALL=(ALL)       NOPASSWD:/tmp/top.bash,/tmp/bott.bash

And then just run /tmp/top.bash as user saml:

$ /tmp/top.bash 
running /tmp/top.bash
sam
running /tmp/bott.bash
root

I get the above. Which is what I would expect.

  • Thanks. This all works for me, except for sudo -v in top.bash (and the while loop in my original script). Maybe I can find a way around using those... – MountainX Mar 18 '14 at 21:51
  • I ran /tmp/top.bash without sudo and as my regular user; that's how my real script gets called. It worked. It even works if I add in the while true loop. But in my real script it does not work unless I remove sudo -v and the while true loop. However, I see no differences in the code at all. Very strange... – MountainX Mar 18 '14 at 22:04
  • @MountainX - see updates. – slm Mar 18 '14 at 22:20
  • Thanks. Yes, I had to do the same alteration of /etc/sudoers. So our results are the same for the test script. But my actual script chokes on sudo -v (as in top.bash) and I cannot find any differences in the code (or file permissions). – MountainX Mar 19 '14 at 0:51
  • @MountainX - is apparmor enabled? I'm wondering if it's interfering w/ the locations of scripts even though sudo is allowing it. – slm Mar 19 '14 at 1:02
2

If you use Ubuntu, you should add your line at the end of /etc/sudoers, so no others lines can override your entry.

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

If your entry goes before %sudo entry, it will override your entry, because in Ubuntu, you are in sudo group:

$ id
uid=1000(cuonglm) gid=1000(cuonglm) groups=1000(cuonglm),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),109(lpadmin),124(sambashare)

And you must allow both your wrapper script and actual script (In your case, it's /usr/local/bin/backup and /opt/storeBackup/bin/storeBackup.pl)

0

This info is for @slm. (See https://unix.stackexchange.com/a/120159/15010 .) Even with this simple case, it asks for the password.

$ sudo cat /etc/sudoers

tester2 ALL=(ALL) NOPASSWD: /usr/local/bin/backup, /opt/storeBackup/bin/storeBackup.pl

tester2@11038-VirtualBox:~$ sudo -l

Matching Defaults entries for tester2 on this host:
    env_reset,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin,
    !tty_tickets

User tester2 may run the following commands on this host:
    (ALL : ALL) ALL
    (ALL) NOPASSWD: /usr/local/bin/backup, (ALL) /opt/storeBackup/bin/storeBackup.pl

I'm testing with only one file (this one):
$cat /usr/local/bin/backup

#!/bin/bash

echo "$0"
sudo -v 
whoami

The above file is executable and it is owned by the user (tester2 / id 1000).

And running this commmand strace -s 2000 -o sudo.log /usr/local/bin/backup from tester2's account looks like this (and I entered the password):

execve("/usr/local/bin/backup", ["backup"], [/* 45 vars */]) = 0
brk(0)                                  = 0x9be0000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77d3000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=74931, ...}) = 0
mmap2(NULL, 74931, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb77c0000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0PW\0\0004\0\0\0\210\324\1\0\0\0\0\0004\0 \0\7\0(\0\33\0\32\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0P\264\1\0P\264\1\0\5\0\0\0\0\20\0\0\1\0\0\0\320\266\1\0\320\306\1\0\320\306\1\0\270\34\0\0| \0\0\6\0\0\0\0\20\0\0\2\0\0\0\264\316\1\0\264\336\1\0\264\336\1\0\310\0\0\0\310\0\0\0\6\0\0\0\4\0\0\0\4\0\0\0\24\1\0\0\24\1\0\0\24\1\0\0$\0\0\0$\0\0\0\4\0\0\0\4\0\0\0P\345td\310\220\1\0\310\220\1\0\310\220\1\0\204\5\0\0\204\5\0\0\4\0\0\0\4\0\0\0Q\345td\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\4\0\0\0R\345td\320\266\1\0\320\306\1\0\320\306\1\0000\31\0\0000\31\0\0\4\0\0\0\1\0\0\0\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\261x\200\265F\310?m\300\226\33\327\267y\24\374\371ge4\203\0\0\0007\0\0\0 \0\0\0\n\0\0\0@\20\0\4\2\213\0\224\200\1\220\10\0021\26\270@\0\0 9\20\2448q\262\25}\\\26\244\202\350\3277e:F&\300\212C\6j\0\260H*V$ ,\10\203\1A\20\31\0\21*\200 \24\241\0\fa*(D\10\35\1b!\203\305@\20Y\2\212\20\213\31b@ \200\0\0\204\324\0\24PF\310YI\201. P\201\33\n\241B\2A\272\234\246\n\10 \260\351\24$\217)0N\366@7\0\0\0008\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0:\0\0\0;\0\0\0\0\0\0\0=\0\0\0\0\0\0\0?\0\0\0A\0\0\0C\0\0\0", 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=121024, ...}) = 0
mmap2(NULL, 124748, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb77a1000
mmap2(0xb77bd000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b) = 0xb77bd000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`\n\0\0004\0\0\0t1\0\0\0\0\0\0004\0 \0\t\0(\0 \0\37\0\6\0\0\0004\0\0\0004\0\0\0004\0\0\0 \1\0\0 \1\0\0\5\0\0\0\4\0\0\0\3\0\0\0\307\32\0\0\307\32\0\0\307\32\0\0\23\0\0\0\23\0\0\0\4\0\0\0\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\!\0\0\\!\0\0\5\0\0\0\0\20\0\0\1\0\0\0\244.\0\0\244>\0\0\244>\0\0\240\1\0\0\324\1\0\0\6\0\0\0\0\20\0\0\2\0\0\0\300.\0\0\300>\0\0\300>\0\0\10\1\0\0\10\1\0\0\6\0\0\0\4\0\0\0\4\0\0\0T\1\0\0T\1\0\0T\1\0\0D\0\0\0D\0\0\0\4\0\0\0\4\0\0\0P\345td\334\32\0\0\334\32\0\0\334\32\0\0\324\0\0\0\324\0\0\0\4\0\0\0\4\0\0\0Q\345td\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\4\0\0\0R\345td\244.\0\0\244>\0\0\244>\0\0\\\1\0\0\\\1\0\0\4\0\0\0\1\0\0\0\4\0\0\0\24\0\0\0\3\0\0\0GNU\0;\nY\324X\267\371\341Zj\21\232i,\366\323\307\333C\364\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\30\0\0\0\26\0\0\0\30\0\0\0\4\0\0\0\7\0\0\0\230\0\21\0\0B\0\0\202\0`\10\223(\10\336\30\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\31\0\0\0\0\0\0\0\32\0\0\0\33\0\0\0\0\0\0\0\35\0\0\0\0\0\0\0\0\0\0\0\36\0\0\0 \0\0\0!\0\0\0\0\0\0\0\0\0\0\0\"\0\0\0", 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=13940, ...}) = 0
mmap2(NULL, 16504, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb779c000
mmap2(0xb779f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2) = 0xb779f000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0000\226\1\0004\0\0\0p`\32\0\0\0\0\0004\0 \0\n\0(\0#\0\"\0\6\0\0\0004\0\0\0004\0\0\0004\0\0\0@\1\0\0@\1\0\0\5\0\0\0\4\0\0\0\3\0\0\0h\263\26\0h\263\26\0h\263\26\0\23\0\0\0\23\0\0\0\4\0\0\0\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\320-\32\0\320-\32\0\5\0\0\0\0\20\0\0\1\0\0\0\3001\32\0\3001\32\0\3001\32\0\34-\0\0\34Y\0\0\6\0\0\0\0\20\0\0\2\0\0\0|M\32\0|M\32\0|M\32\0\360\0\0\0\360\0\0\0\6\0\0\0\4\0\0\0\4\0\0\0t\1\0\0t\1\0\0t\1\0\0D\0\0\0D\0\0\0\4\0\0\0\4\0\0\0\7\0\0\0\3001\32\0\3001\32\0\3001\32\0\10\0\0\0@\0\0\0\4\0\0\0\4\0\0\0P\345td|\263\26\0|\263\26\0|\263\26\0\354v\0\0\354v\0\0\4\0\0\0\4\0\0\0Q\345td\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\4\0\0\0R\345td\3001\32\0\3001\32\0\3001\32\0@\36\0\0@\36\0\0\4\0\0\0\1\0\0\0\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\240\rn\0W\32Y\263\23\220\314\370S\322}\320-\37\350\270\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\30\0\0\0\363\3\0\0\t\0\0\0\0\2\0\0\16\0\0\0\2400\20D\200 \2\1\214\3\346\220AE\210\0\204\0\10\0E\200\0`\300\200\0\f\212\f\0\0010\0\10@2\10\256\4\210H6l\240\0260\0&\204\200\216\4\10B$", 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1730024, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb779b000
mmap2(NULL, 1739484, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb75f2000
mmap2(0xb7795000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a3) = 0xb7795000
mmap2(0xb7798000, 10972, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7798000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb75f1000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb75f16c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb7795000, 8192, PROT_READ)   = 0
mprotect(0xb779f000, 4096, PROT_READ)   = 0
mprotect(0xb77bd000, 8192, PROT_READ)   = 0
mprotect(0x8124000, 4096, PROT_READ)    = 0
mprotect(0xb77f6000, 4096, PROT_READ)   = 0
munmap(0xb77c0000, 74931)               = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
open("/dev/tty", O_RDWR|O_NONBLOCK|O_LARGEFILE) = 3
close(3)                                = 0
brk(0)                                  = 0x9be0000
brk(0x9be1000)                          = 0x9be1000
open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=4447600, ...}) = 0
mmap2(NULL, 2097152, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb73f1000
mmap2(NULL, 262144, PROT_READ, MAP_PRIVATE, 3, 0x2bd) = 0xb73b1000
mmap2(NULL, 4096, PROT_READ, MAP_PRIVATE, 3, 0x43a) = 0xb73b0000
close(3)                                = 0
brk(0x9be2000)                          = 0x9be2000
brk(0x9be3000)                          = 0x9be3000
getuid32()                              = 1000
getgid32()                              = 1000
geteuid32()                             = 1000
getegid32()                             = 1000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
time(NULL)                              = 1395267410
brk(0x9be4000)                          = 0x9be4000
open("/proc/meminfo", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb73af000
read(3, "MemTotal:        2061512 kB\nMemFree:          161556 kB\nBuffers:           23816 kB\nCached:          1229076 kB\nSwapCached:            0 kB\nActive:          1038852 kB\nInactive:         792548 kB\nActive(anon):     447940 kB\nInactive(anon):   161448 kB\nActive(file):     590912 kB\nInactive(file):   631100 kB\nUnevictable:           0 kB\nMlocked:               0 kB\nHighTotal:       1183688 kB\nHighFree:          14988 kB\nLowTotal:         877824 kB\nLowFree:          146568 kB\nSwapTotal:       2095100 kB\nSwapFree:        2095028 kB\nDirty:                60 kB\nWriteback:             0 kB\nAnonPages:        578540 kB\nMapped:           156860 kB\nShmem:             30880 kB\nSlab:              48428 kB\nSReclaimable:      36208 kB\nSUnreclaim:        12220 kB\nKernelStack:        2672 kB\nPageTables:         8804 kB\nNFS_Unstable:          0 kB\nBounce:                0 kB\nWritebackTmp:          0 kB\nCommitLimit:     3125856 kB\nCommitted_AS:    1922516 kB\nVmallocTotal:     122880 kB\nVmallocUsed:       28356 kB\nVmallocChunk:   ", 1024) = 1024
close(3)                                = 0
munmap(0xb73af000, 4096)                = 0
brk(0x9be5000)                          = 0x9be5000
rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTART}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTART}, {SIG_DFL, [], SA_RESTART}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], 0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [], 0}, {SIG_DFL, [], 0}, 8) = 0
uname({sys="Linux", node="11038-VirtualBox", ...}) = 0
brk(0x9be6000)                          = 0x9be6000
brk(0x9be7000)                          = 0x9be7000
stat64("/home/tester2", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getpid()                                = 8307
open("/usr/lib/i386-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=26256, ...}) = 0
mmap2(NULL, 26256, PROT_READ, MAP_SHARED, 3, 0) = 0xb73a9000
close(3)                                = 0
brk(0x9be8000)                          = 0x9be8000
getppid()                               = 8306
gettimeofday({1395267410, 397418}, NULL) = 0
brk(0x9be9000)                          = 0x9be9000
brk(0x9bea000)                          = 0x9bea000
getpgrp()                               = 8306
rt_sigaction(SIGCHLD, {0x8085410, [], SA_RESTART}, {SIG_DFL, [], SA_RESTART}, 8) = 0
getrlimit(RLIMIT_NPROC, {rlim_cur=15942, rlim_max=15942}) = 0
brk(0x9beb000)                          = 0x9beb000
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
open("/usr/local/bin/backup", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfad4848) = -1 ENOTTY (Inappropriate ioctl for device)
_llseek(3, 0, [0], SEEK_CUR)            = 0
read(3, "#!/bin/bash\n\necho \"$0\"\n\nsudo -v\nwhoami\n\n", 80) = 40
_llseek(3, 0, [0], SEEK_SET)            = 0
getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=4*1024}) = 0
fcntl64(255, F_GETFD)                   = -1 EBADF (Bad file descriptor)
dup2(3, 255)                            = 255
close(3)                                = 0
fcntl64(255, F_SETFD, FD_CLOEXEC)       = 0
fcntl64(255, F_GETFL)                   = 0x8000 (flags O_RDONLY|O_LARGEFILE)
fstat64(255, {st_mode=S_IFREG|0755, st_size=40, ...}) = 0
_llseek(255, 0, [0], SEEK_CUR)          = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(255, "#!/bin/bash\n\necho \"$0\"\n\nsudo -v\nwhoami\n\n", 40) = 40
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
brk(0x9bec000)                          = 0x9bec000
write(1, "/usr/local/bin/backup\n", 22) = 22
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
stat64(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/usr/local/sbin/sudo", 0xbfad4600) = -1 ENOENT (No such file or directory)
stat64("/usr/local/bin/sudo", 0xbfad4600) = -1 ENOENT (No such file or directory)
stat64("/usr/sbin/sudo", 0xbfad4600)    = -1 ENOENT (No such file or directory)
stat64("/usr/bin/sudo", {st_mode=S_IFREG|S_ISUID|0755, st_size=69708, ...}) = 0
stat64("/usr/bin/sudo", {st_mode=S_IFREG|S_ISUID|0755, st_size=69708, ...}) = 0
geteuid32()                             = 1000
getegid32()                             = 1000
getuid32()                              = 1000
getgid32()                              = 1000
access("/usr/bin/sudo", X_OK)           = 0
stat64("/usr/bin/sudo", {st_mode=S_IFREG|S_ISUID|0755, st_size=69708, ...}) = 0
geteuid32()                             = 1000
getegid32()                             = 1000
getuid32()                              = 1000
getgid32()                              = 1000
access("/usr/bin/sudo", R_OK)           = 0
stat64("/usr/bin/sudo", {st_mode=S_IFREG|S_ISUID|0755, st_size=69708, ...}) = 0
stat64("/usr/bin/sudo", {st_mode=S_IFREG|S_ISUID|0755, st_size=69708, ...}) = 0
geteuid32()                             = 1000
getegid32()                             = 1000
getuid32()                              = 1000
getgid32()                              = 1000
access("/usr/bin/sudo", X_OK)           = 0
stat64("/usr/bin/sudo", {st_mode=S_IFREG|S_ISUID|0755, st_size=69708, ...}) = 0
geteuid32()                             = 1000
getegid32()                             = 1000
getuid32()                              = 1000
getgid32()                              = 1000
access("/usr/bin/sudo", R_OK)           = 0
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
_llseek(255, -8, [32], SEEK_CUR)        = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb75f1728) = 8308
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {0x80829d0, [], 0}, {SIG_DFL, [], 0}, 8) = 0
waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 8308
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
waitpid(-1, 0xbfad4038, WNOHANG)        = -1 ECHILD (No child processes)
sigreturn()                             = ? (mask now [])
rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {0x80829d0, [], 0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(255, "whoami\n\n", 40)             = 8
stat64(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64("/usr/local/sbin/whoami", 0xbfad4600) = -1 ENOENT (No such file or directory)
stat64("/usr/local/bin/whoami", 0xbfad4600) = -1 ENOENT (No such file or directory)
stat64("/usr/sbin/whoami", 0xbfad4600)  = -1 ENOENT (No such file or directory)
stat64("/usr/bin/whoami", {st_mode=S_IFREG|0755, st_size=22060, ...}) = 0
stat64("/usr/bin/whoami", {st_mode=S_IFREG|0755, st_size=22060, ...}) = 0
geteuid32()                             = 1000
getegid32()                             = 1000
getuid32()                              = 1000
getgid32()                              = 1000
access("/usr/bin/whoami", X_OK)         = 0
stat64("/usr/bin/whoami", {st_mode=S_IFREG|0755, st_size=22060, ...}) = 0
geteuid32()                             = 1000
getegid32()                             = 1000
getuid32()                              = 1000
getgid32()                              = 1000
access("/usr/bin/whoami", R_OK)         = 0
stat64("/usr/bin/whoami", {st_mode=S_IFREG|0755, st_size=22060, ...}) = 0
stat64("/usr/bin/whoami", {st_mode=S_IFREG|0755, st_size=22060, ...}) = 0
geteuid32()                             = 1000
getegid32()                             = 1000
getuid32()                              = 1000
getgid32()                              = 1000
access("/usr/bin/whoami", X_OK)         = 0
stat64("/usr/bin/whoami", {st_mode=S_IFREG|0755, st_size=22060, ...}) = 0
geteuid32()                             = 1000
getegid32()                             = 1000
getuid32()                              = 1000
getgid32()                              = 1000
access("/usr/bin/whoami", R_OK)         = 0
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
_llseek(255, -1, [39], SEEK_CUR)        = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb75f1728) = 8309
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {0x80829d0, [], 0}, {SIG_DFL, [], 0}, 8) = 0
waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 8309
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
waitpid(-1, 0xbfad4038, WNOHANG)        = -1 ECHILD (No child processes)
sigreturn()                             = ? (mask now [])
rt_sigaction(SIGINT, {SIG_DFL, [], 0}, {0x80829d0, [], 0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(255, "\n", 40)                     = 1
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(255, "", 40)                       = 0
exit_group(0)                           = ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.