moving a file to a folder with root privileges in CentOS 7

7,445

If you have the sudo package try gksudo nautilus, otherwise use sudo mv -v /home/username/Desktop/script.sh /etc/profile.d/script.sh For more, try man mv

sudo elevates the command following it temporarily to perform tasks like you describred.

Share:
7,445

Related videos on Youtube

RabT
Author by

RabT

Updated on September 18, 2022

Comments

  • RabT
    RabT over 1 year

    I am reading a tutorial that wants me to place a script file called script.sh into a folder called /etc/profile.d/. However, when I try to save the script.sh file in that directory, the gedit tool gives me an error stating that I do not have privileges to save in that folder. So I saved script.sh on the desktop temporarily. I cannot even view the contents of the /etc/ folder through the GUI. (Unless it is empty and I am seeing truly empty contents.) I can run the terminal as root by typing su - root, but what do I type to either move the script.sh file from the desktop to /etc/profile.d/script.sh or to open gedit in a way that lets me save it to /etc/profile.d/script.sh?

    • eyoung100
      eyoung100 over 9 years
      If you have the sudo package try gksudo nautilus, otherwise use sudo mv -v /home/username/Desktop/script.sh /etc/profile.d/script.sh For more, try man mv