Announcement

Collapse
No announcement yet.

accidently used chmod wrong

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    accidently used chmod wrong

    Hi,

    I think i made a huge mistake. Because i wanted to add new wallpaper to the /usr/share/wallpapers directory (i change wallpapers regularly) i first
    did: sudo chmod 755 /usr/share/wallwapers. But that didnt work. Then i did: sudo chmod -R 755 /usr/share. Did not work. Then, i did: sudo chmod -R 755 /usr.

    Now i cant even start sudo because the setuid bit isnt set. Is there anyway to fix this without reinstalling the entire system?

    #2
    First, a lecture: Good general practice is to not go mucking about in the system area unless it's absolutely required and you know what you're doing. In this case, it was not required at all.

    Right-click on the desktop and select "Open" and pick a wallpaper from your home directory - maybe in the Pictures folder? That's what home and those folders are for. If you want to make a wallpaper available to all users, by all means use sudo and copy it into the /usr/share/wallpapers folder but there's no need to modify the folder permissions, just use sudo as it's intended.

    Second: 755 is the "normal" permission setting for most system folders. It converts to drwxr-xr-x so I'm totally baffled as to what exactly you did. 644 would have rendered the folders un-listable to you but is the normal permission for most system files: -rw-r--r-- Also, as far as I know the setuid bit isn't set anywhere on the system, so why do you think you need it?

    Finally: the sudoers file isn't under /usr it's under /etc and it's permissions are -r--r----- So how is that messed up?

    Please Read Me

    Comment


      #3
      The answer to your question is: Either boot to a USB and go into your hard drive as root or boot to recovery mode, re-mount as root (there's a menu option to do that), and fix it there.

      But first you have to know what you did before you can reverse it. Your description above doesn't explain your problem.

      Please Read Me

      Comment


        #4
        thanks for the lecture prof

        What i did: sudo chmod -R 755 /usr

        now when i execute sudo i get:

        sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set.
        Last edited by linuxmonkey; Jun 12, 2015, 04:36 PM.

        Comment


          #5
          Once you fix /usr, you may still have to go and fix sudo:

          http://askubuntu.com/questions/45286...setuid-bit-set

          Comment


            #6
            Well you're absolutely correct, reviewing /usr/bin shows many varied permissions including sudo at 4775.

            This changes my answer to your problem: Reinstalling is your only solution. It would takes weeks to set them all correctly.

            You might consider using btrfs instead of ext4 for your next install. Then you can do a snapshot of your root filesystem before you mess around. If you break it, just rollback to the snapshot and start over.

            Sorry I don't have a better suggestion...

            Please Read Me

            Comment


              #7
              Originally posted by oshunluvr View Post
              Well you're absolutely correct, reviewing /usr/bin shows many varied permissions including sudo at 4775.

              This changes my answer to your problem: Reinstalling is your only solution. It would takes weeks to set them all correctly.
              There are also a bunch of directories/files with the SGID bit set and most files would not be executable, etc.

              And I concur, reinstalling is the quickest and surest way to fix things (you'll likely run into numerous weird problems if you don't).

              Like already mentioned, never run chmod (or chown) recursively unless you are really, really sure you know what you're doing and why (especially in system directories, where it is almost always the wrong thing to do)

              Comment


                #8
                thanks for your input. just did a reinstall. luckily for me the /home was on another partition so it wasnt as bad

                you would probably go againt this, but is it possible to give one extra user root access? I am the only user on my system, and i
                am getting sick and tired of every time having to type in sudo. Futhermore rootacces does not work smooth in dolphin. I installed the root access
                service. But i cant copy files that i download to system folders. Copy goes fine, but i cant paste it.

                I am just getting tired of having to type in a password every time i want to do something out of my home directory.
                Last edited by linuxmonkey; Jun 13, 2015, 05:33 AM.

                Comment


                  #9
                  Yes you can give another user admin access (sudo rights). You can also use sudo -i to switch to a root session in a terminal or even put in a root password thus enabling the root account.

                  However one has to wonder, given your recent re-install, if maybe you should re-evaluate your workflow? I mean just how often are you moving files in and out of the system area and why? Actually, there no reason you can't just enable the root account and start logging in as root all the time. Except of course it removes all the protection your system has from you - the user - messing things up. The general consensus in the linux world is this is a horrible idea that will lead to destruction. But then again, it is your system.

                  Honestly, if you're the only user on your system, I can't imagine why you're bothering to move things like wallpapers into the system area. It serves no purpose at all and actually is a deficit. For example; everything you downloaded and moved into the system area is now deleted because you had to re-install. The reason most all of us have and recommend a separate /home is because of exactly that. If you have a particular need to do this for some, post a thread and maybe someone will offer a solution that won't blow up your system.

                  A way to think of it is like this: File permissions are like a wall. You (the user) keep your toys on your side of the wall and root keeps his toys on his side. He doesn't throw things over to you and your shouldn't be throwing things over to him. The password required to throw something over the wall is a warning: If you throw something over the wall, root might do something with it you don't like. Case in point: messing up the file permissions of half your system. The password is to intentionally slow you down and make you question your action.

                  I'm going out go out on a limb and guess you recently changed from Windows? Assuming this is true, one of the first things you have to learn to accept is Linux is not Windows. Sometimes a new Linux user will spend months or even years trying to make Linux act like Windows. This always ends in frustration and problems. Eventually, the new user either begins to accept the Linux environment and embrace the new world he's in - or he goes back to Windows. Before you once again have to re-install, you might want to consider why you switched to Linux in the first place.

                  Anyway, free advice is worth what you pay for it. Good luck.

                  Please Read Me

                  Comment


                    #10
                    Thanks for your answer. Well I normally dont mess around too much with the filesystem outside my home dir. I am not a first time linux user. Been using the system since 2.20 kernel came out. But then i switched
                    back to windows because of my work situation. 2 years ago i switched back to linux because of a job change. been using xubuntu, just recently switched to kubuntu.

                    The problem with the wallpapers is that when you want to change a wallpaper the system only displays the wallpapers located in /usr/share/wallpapers. Sure you can click on add, but then you can only add
                    one wallpaper (and not a dir ). This is cumbersome. Thats why i just put all the wallpapers i download into /usr/share/wallpapers

                    other command i execute on a daily/hourly basis: apt-get, services..and those commands need root access. so everytime i have to type in sudo. its just annoying. I just have my user account
                    set up the way i like it. so i dont want to switch to root and have to set that account up all over again. just want my user account to have root priv.

                    Comment


                      #11
                      Well, addressing the wallpaper thing; when I click on "Open" and select a folder (/home/me/pictures/wallpapers) and then add a wallpaper;

                      1. It stays available in the list of wallpapers
                      2. The location that I opened is remembered. The next time I click "Open" the same folder opens - at least until I reboot.

                      I'm sorry but IMO, it just doesn't seem that difficult nor is there any reason to do it more than once or twice a month. How often do you add new wallpapers and change your desktop? Hourly?

                      Whatever, it's your system so treat it how you want.

                      Please Read Me

                      Comment

                      Working...
                      X