Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26

Thread: What is the each command's different merit between su and sudo?

  1. #11
    Join Date
    Mar 2007
    Location
    Denver, CO
    Beans
    7,836
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: What is the each command's different merit between su and sudo?

    There are many ways to skin the cat. I just don't like the --forced option due to the lack of the root user. How backups are performed is kind of redirecting the argument here.

  2. #12
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    19,253
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: What is the each command's different merit between su and sudo?

    Quote Originally Posted by kevdog View Post
    There are many ways to skin the cat. I just don't like the --forced option due to the lack of the root user. How backups are performed is kind of redirecting the argument here.
    There's no difference in the result from acme.sh with sudo vs root provide we are consistent about using
    Code:
    $ sudo acme.sh
    or
    Code:
    $ sudo -H acme.sh
    Consistency is the key.

    We've probably highjacked this thread too much already.

  3. #13
    Join Date
    Mar 2007
    Location
    Denver, CO
    Beans
    7,836
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: What is the each command's different merit between su and sudo?

    @TheFu

    Agreed. No more hijacking.

  4. #14
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    2,795
    Distro
    Ubuntu Development Release

    Re: What is the each command's different merit between su and sudo?

    I will use "su" mode instead of the "sudo" command prefix when attempting to delete many many root owned files in one command.
    Why, because "sudo" has an arbitrary, and rather low, limit on the argument list.

    Example: 10,000 root owned files:
    Code:
    doug@s15:~/sudo/test$ ls -l | head
    total 40000
    -rw-r--r-- 1 root root 1024 Mar 22 09:07 ab00000000.txt
    -rw-r--r-- 1 root root 1024 Mar 22 09:07 ab00000001.txt
    -rw-r--r-- 1 root root 1024 Mar 22 09:07 ab00000002.txt
    -rw-r--r-- 1 root root 1024 Mar 22 09:07 ab00000003.txt
    ...
    Try to delete using "sudo":

    Code:
    doug@s15:~/sudo/test$ sudo rm *
    sudo: unable to execute /bin/rm: Argument list too long
    Now, delete using "su" to become root:
    Code:
    doug@s15:~/sudo/test$ sudo su
    root@s15:/home/doug/sudo/test# rm *
    root@s15:/home/doug/sudo/test# exit
    exit
    doug@s15:~/sudo/test$
    note that even root (and normal users, for their owned files) has an argument list limit, it's just way bigger.
    Example (100,000 files):
    Code:
    root@s15:/home/doug/sudo/test# rm *
    bash: /bin/rm: Argument list too long
    root@s15:/home/doug/sudo/test#
    While not really relevant, my real life example is my tcpdump capture logs, at 10 minutes per file internal and external interfaces, which I tend to only post process every couple of months, thus I end up with thousands of files:
    Code:
    -rw-r--r-- 1 root root  65534352 Mar 22 08:47 ext-2020-03-22-08-37-59.bin
    -rw-r--r-- 1 root root 516828264 Mar 22 08:57 ext-2020-03-22-08-47-59.bin
    -rw-r--r-- 1 root root 515930193 Mar 22 09:07 ext-2020-03-22-08-57-59.bin
    -rw-r--r-- 1 root root 536203868 Mar 22 09:17 ext-2020-03-22-09-07-59.bin
    -rw-r--r-- 1 root root 323516146 Mar 22 09:28 ext-2020-03-22-09-17-59.bin
    -rw-r--r-- 1 root root     81920 Mar 22 09:29 ext-2020-03-22-09-28-01.bin
    Last edited by Doug S; 1 Week Ago at 05:31 PM.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  5. #15
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    19,253
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: What is the each command's different merit between su and sudo?

    xargs --max-lines=128000
    or
    xargs --max-chars=4096
    will send chunks of arguments to the command.

    https://www.gnu.org/software/finduti...mand-Size.html

  6. #16
    Join Date
    Mar 2020
    Beans
    11

    Re: What is the each command's different merit between su and sudo?

    Hello!

    Thank you for reply may times!

    I've read them.

    Finishing checking, I will post about what I learn with a lot comments!

  7. #17
    Join Date
    Mar 2020
    Beans
    11

    Re: What is the each command's different merit between su and sudo?

    Hello malspa!
    Do you use both of command?

    I want to know subjective and objective,
    both opinions.

    Thank you for first comment!

  8. #18
    Join Date
    Mar 2020
    Beans
    11

    Re: What is the each command's different merit between su and sudo?

    I appreciate showing the most reliable page, yancek!

    The part "Advantages and Disadvantages" seems suit
    my question perfectly.

    Thank you!

  9. #19
    Join Date
    Mar 2020
    Beans
    11

    Re: What is the each command's different merit between su and sudo?

    Quote Originally Posted by TheFu View Post
    sudoedit is the best, safest, way I know to edit system files. Every time I see some article somewhere with sudo gedit I cringe a little. Doing that can break a system, if the userid running it hadn't already used gedit before WITHOUT sudo. Actually, this applies to almost any GUI program and sudo or su. In general, don't use either with GUI programs is the best advice. Sure, there are exceptions and techniques to get around the issues caused, but noob-users need to learn much more BEFORE those exceptions can make sense.
    I understand that
    Basically, it is better not to use su and sudo command with GUI programms.
    And sudoedit is the best way to edit system files.

    In other topic, how to allow users run su command in BSD,
    some comment shows certain better way to changing
    cunfiguration as well as you showed me.

    I will break my system without such advice.

    Thank you, TheFu!

  10. #20
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    2,795
    Distro
    Ubuntu Development Release

    Re: What is the each command's different merit between su and sudo?

    Quote Originally Posted by TheFu View Post
    xargs --max-lines=128000
    or
    xargs --max-chars=4096
    will send chunks of arguments to the command.

    https://www.gnu.org/software/finduti...mand-Size.html
    I was just trying to reply to the question, but thanks. However, I am always wanting to learn more, but so far haven't been able to use xargs to overcome the issue. Note sure what I'm doing wrong.

    EDIT: (I stopped being so lazy) This seems to work for 200,000 root owned files:
    Code:
    ls | xargs rm
    However, it can have issues also:
    Code:
    doug@s15:~/sudo/test$ ls *.txt | xargs rm
    -bash: /bin/ls: Argument list too long
    rm: missing operand
    Try 'rm --help' for more information.
    doug@s15:~/sudo/test$
    which can be solved by, for example:
    Code:
    printf '%s ' *.txt | xargs rm
    however, if I try:
    Code:
    doug@s15:~/sudo/test$ printf '%s ' *.txt | xargs sudo rm
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    sudo: unable to execute /bin/rm: Argument list too long
    it doesn't work because the default list limit is too long, as per my original issue with sudo.But, and as the fu suggested, this works:
    Code:
    doug@s15:~/sudo/test$ printf '%s ' *.txt | xargs --max-procs=6 --max-args=1000 sudo rm
    doug@s15:~/sudo/test$ ls -l
    total 0
    Last edited by Doug S; 1 Week Ago at 08:15 PM.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

Page 2 of 3 FirstFirst 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •