Results 1 to 4 of 4

Thread: How do I perform a backup of and restore /etc/sudoers file?

Hybrid View

  1. #1
    Join Date
    Dec 2012
    Beans
    51

    How do I perform a backup of and restore /etc/sudoers file?

    Could someone show me how to:

    1. backup
    2. restore

    the /etc/sudoers file?

    I need some handholding.

    Thanks in advance.

  2. #2
    Join Date
    Mar 2012
    Location
    Near one of my computers
    Beans
    307
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How do I perform a backup of and restore /etc/sudoers file?

    Fairly easy. Just do it from command line.

    Open terminal.

    Use the 'sudo' command. This lets you use the administrative privileges.

    Use the copy command
    Code:
    'cp /file/to/copy/ /path/to/new/copy'
    So we start with sudo, then use the cp command to take the /etc/sudoers file and make a copy of it somewhere else like /etc/sudoers.backup

    Code:
    sudo cp /etc/sudoers /etc/sudoers.backup
    Now if you use the list command 'ls' you should be able to see both files in the /etc/ directory. We'll use 'grep' to filter the results.

    Code:
    ls /etc/
    As you can see there's tons of stuff. So pipe it with '|' to grep and find a match.

    Code:
    ls /etc/ | grep sudoers
    To restore it, you simply have to move 'mv' the backup file back into place. So replace the 'cp' command with 'mv' and reverse the files.

    Code:
    sudo mv /etc/sudoers.backup /etc/sudoers
    Hope this helps. Good Luck!

    Kopkins
    ArchLinux + Ubuntu 12.04 + OS X on MacBook Pro 8Gb RAM Intel i5 SandyBridge

  3. #3
    Join Date
    Dec 2012
    Beans
    51

    Re: How do I perform a backup of and restore /etc/sudoers file?

    Thank you, Kopkins, for the detailed explanation

  4. #4
    Join Date
    Mar 2012
    Location
    Near one of my computers
    Beans
    307
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How do I perform a backup of and restore /etc/sudoers file?

    No problem! Glad to help!

    Kopkins
    ArchLinux + Ubuntu 12.04 + OS X on MacBook Pro 8Gb RAM Intel i5 SandyBridge

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
  •