FedoraForum.org - Fedora Support Forums and Community
Results 1 to 12 of 12
  1. #1
    Join Date
    Jan 2013
    Location
    New York state in USA
    Posts
    164

    BASH scrip for software installs SU SUDO or something different

    I recall reading somewhere once that installing software while logged in as SU is very bad for security, but DNF will only run under root authority. Is using SUDO the safe way to run my software installation script or do I need to do something different?

    Thanks in advance for your help
    Have a Great Day!

  2. #2
    Join Date
    Apr 2017
    Location
    Germany
    Posts
    14

    Re: BASH scrip for software installs SU SUDO or something different

    You usually don't need to run your whole session as root. Just use sudo for all commands that need higher privileges (like installing software with dnf). Sudo is definitely safe.

    Regards,
    Reventon1988

  3. #3
    Join Date
    Jan 2013
    Location
    New York state in USA
    Posts
    164

    Re: BASH scrip for software installs SU SUDO or something different

    I think I read that if you install software with DNF while you are logged in as SU that the installed software will have ROOT authority. Is that true? If it is, will SUDO also transfer ROOT authority to the installed software? If it does I can see where that would be a big problem.

    Thanks in advance for your continued help on this.
    Have a Great Day!

  4. #4
    Join Date
    Apr 2017
    Location
    Germany
    Posts
    14

    Re: BASH scrip for software installs SU SUDO or something different

    Installing software while being logged in as root in the terminal doesn't make said software run with root privileges after that. If your whole graphical session runs with root privileges though (as in logging in as root in the gnome login screen, if your using the gnome desktop, for example), all software you will execute (e.g. firefox) will have root privileges, which is why running xorg as root is NOT advised. And no, installing software via sudo also doesn't subsequently make it run as root. If your running wayland though then this problem can't even occur, because you can't let graphical applications run as root.

    Regards,
    Reventon1988

  5. #5
    Join Date
    Jan 2013
    Location
    New York state in USA
    Posts
    164

    Re: BASH scrip for software installs SU SUDO or something different

    Thank you very much. I appreciate your help.
    Have a Great Day!

  6. #6
    Join Date
    Apr 2017
    Location
    Germany
    Posts
    14

    Re: BASH scrip for software installs SU SUDO or something different

    No problem. The forums are here for helping each other

  7. #7
    Join Date
    Jun 2005
    Location
    Montreal, Que, Canada
    Posts
    4,986

    Re: BASH scrip for software installs SU SUDO or something different

    Normally, dnf is given root privileges to allow access to directories. The application installs with the inherited privileges of the directory into which the application will reside. if a new object (pgm, lib, parameter file) inherits the properties of the application or file that is being replaced or upgraded.
    .
    Last edited by lsatenstein; 15th February 2018 at 05:15 AM.
    Leslie in Montreal

    Interesting web sites list
    http://forums.fedoraforum.org/showth...40#post1697840

  8. #8
    Join Date
    Jan 2013
    Location
    New York state in USA
    Posts
    164

    Re: BASH scrip for software installs SU SUDO or something different

    Thank you very much for the additional information on how permissions are inherited.

    If you don't mind I have a followup question. If graphical programs can't run with root authority under Wayland and root authority is required for the directory access required when installing software, how is it that Dnfdragora is able to install programs?
    Have a Great Day!

  9. #9
    Join Date
    Jan 2007
    Posts
    92

    Re: BASH scrip for software installs SU SUDO or something different

    There is a difference between running Wayland/xorg as root, and running a root privileged app on top of it as a normal user. When you run dnfdragora as a normal user, it will run just fine without a root password. Once you apply the updates/installs, it will ask you for the root password (unless you ran it as sudo first). I believe yumex-dnf works the same way.

  10. #10
    Join Date
    Jan 2013
    Location
    New York state in USA
    Posts
    164

    Re: BASH scrip for software installs SU SUDO or something different

    Then I'm guessing that the reason I can run dnfdragora to do installs or updates without ever giving the root password is that I always run dnfdragora from an Administrator account. Is that right?
    Have a Great Day!

  11. #11
    Join Date
    Oct 2007
    Location
    Freedonia
    Age
    68
    Posts
    3,054

    Re: BASH scrip for software installs SU SUDO or something different

    Or, if you prefer using su as I do, you can always do this:

    Code:
    su -c 'dnf install PACKAGENAME'
    Be sure, however, to put the single quotes around the command, as bash doesn't send the command line unaltered to su the way it does with sudo. I don't use sudo because it's my computer, I installed Linux and I know the root password. (Sudo, of course, is for people who need to do admin stuff but don't know the root password.)
    Registered Linux user #470359 and permanently recovered BOFH.

    Any advice in this post is worth exactly what you paid for it.

  12. #12
    Join Date
    Jan 2013
    Location
    New York state in USA
    Posts
    164

    Re: BASH scrip for software installs SU SUDO or something different

    Thank you all for the help. I really appreciate it.
    Have a Great Day!

Similar Threads

  1. Bash will install package without asking for sudo
    By ashafar in forum Security and Privacy
    Replies: 3
    Last Post: 31st July 2015, 05:25 PM
  2. Source code of sudo, su, bash, ps etc etc
    By abhics1 in forum Using Fedora
    Replies: 5
    Last Post: 18th January 2013, 05:50 PM
  3. [SOLVED]
    [bash] sudo sub?
    By sea in forum Programming & Packaging
    Replies: 8
    Last Post: 8th August 2011, 06:56 PM
  4. Example, bash scrip to check remote server up status via ssh and alert
    By dstewart in forum Programming & Packaging
    Replies: 4
    Last Post: 30th December 2010, 11:06 PM
  5. [SOLVED]
    How to Run (not Run in Terminal) bash script with sudo in it?
    By premudriy in forum Using Fedora
    Replies: 2
    Last Post: 6th July 2010, 06:56 PM

Posting Permissions

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