General TC > General TC Talk
sudo'd out
softwaregurl:
I don't know how this would work with vi, but when I do massive edits then can't save them, I save them to /home/tc then as root mv or cp to where they need to be.
I keep using beaver because I know it. Sometime I really need to learn vi. (Or maybe it's just because it's fun sudoing beavers then killing them afterwards ::) ?)
I saw this "Only use you Super Powers when absolutely necessary". But I get what your saying about the number of times a person types sudo. I usually have a terminal and a root terminal open at the same time.
jpeters:
--- Quote from: mikshaw on January 27, 2009, 07:15:29 AM ---You can also do "rm -rf folder". Using sudo with the "rm" command can easily become hazardous....just a simple accidental keypress at the wrong second can destroy ocean liners and devastate planets....or at least delete some important stuff your system needs to live.
--- End quote ---
I tried "rm =rf" on a folder I created in /home/tc with "sudo mkdir" and got "permission denied".
Edit: It works only if empty, but not if there's a file in it. To make the file, of course, you need to use
"sudo".
softwaregurl:
you shouldn't need to use sudo in /home/tc to create a directory or write a file in it. The executable bit on chmod is different then making a file executable, it makes the directory writable. drwx------ or 700 would allow the owner to write inside the directory or drwxrwxrwx 777 would make it world writable (but also world deletable so I like drwxrwxr-x). So writable is just the directory proper and executable is the contents. Then each file inside the directory has it's own ownership and permissions.
(or at least thats how I understand it works. Still learning.)
Edit: i just created another tce directory with the boot option and it is owned by tc:staff and drwxr-xr-x. I created an optional dir inside it and copied a bunch of extensions there from another tce dir without becoming root.
^thehatsrule^:
--- Quote from: mikshaw on January 27, 2009, 07:15:29 AM ---
--- Quote ---The problem is one of permissions, in which case w! doesn't work for either vim or vi. (ie.,root:root)
--- End quote ---
I think what he meant by ":w /path/to/filename" was to use a different, writable path. Then, as root, move the new file over the old & change its ownership back to root. It's still an inconvenience, but at least you keep your edits.
--- End quote ---
Heh, guess I forgot the explanation - thanks.
--- Quote ---Simple rule: For anything outside of /home/tc, be root.
--- End quote ---
Another standard place that's writeable besides ~ is /tmp
--- Quote from: jpeters on January 27, 2009, 11:24:36 AM ---
--- Quote from: mikshaw on January 27, 2009, 07:15:29 AM ---You can also do "rm -rf folder". Using sudo with the "rm" command can easily become hazardous....just a simple accidental keypress at the wrong second can destroy ocean liners and devastate planets....or at least delete some important stuff your system needs to live.
--- End quote ---
I tried "rm =rf" on a folder I created in /home/tc with "sudo mkdir" and got "permission denied".
Edit: It works only if empty, but not if there's a file in it. To make the file, of course, you need to use
"sudo".
--- End quote ---
I think he meant that always using sudo with rm -rf can be dangerous.
--- Quote from: softwaregurl on January 27, 2009, 12:01:09 PM ---The executable bit on chmod is different then making a file executable, it makes the directory writable. drwx------ or 700 would allow the owner to write inside the directory or drwxrwxrwx 777 would make it world writable (but also world deletable so I like drwxrwxr-x). So writable is just the directory proper and executable is the contents. Then each file inside the directory has it's own ownership and permissions.
--- End quote ---
+x on directories means pass-through; +r means listing
mikshaw:
You need to have x on a directory in order to write to (or delete from) it because you need to be able to enter the directory in order to add or delete a file contained within. If your directory is rw-, you can't read the contents of it (the r applies only to the directory file itself, as far as I know), but you can still delete the directory itself if it is empty.
If it's r-x, you can delete it if it's empty (not sure why that works...guessing you at least need to own the directory), and you can also read its contents, but you can't add or delete anything inside. So basically the difference between 500 (dr-x------) and 600 (drw-------) when applied to a directory is that 600 is useless and 500 allows the owner read-only access to its contents. Writing requires both w and x. A typical directory is 755 to allow the owner full access and everyone else read-only access.
--- Quote from: jpeters ---I tried "rm =rf" on a folder I created in /home/tc with "sudo mkdir" and got "permission denied".
--- End quote ---
That's the expected behavior. Anything created with sudo will be owned by root, and therefore you can't delete it as tc. The files in /home/tc are not intended for root. If you do create a file as root within /home/tc and expect to have full control of the file as user tc, you should do 'chown tc' on the file (or 'chown -R tc' for a directory). EDIT: that should preferably be "sudo chown tc.staff" or "sudo chown 1001.50"
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version