04
All about users, files (organization and permissions) from a user, admin, and hacker perspective including "inodes" and "elevating privileges". This is a big topic, so we meander about but cover the main stuff needed to get you started (more than any other Boost we've done so far). We didn't get to linking or glob expansion. We'll start with that next time and introduce grep, find, and regular expressions.
START (20220605171316)
- How to reconnect to a saved VM session with SSH? (20220605172039)
- Where are all my files and why are they there? (20220605173317)
- What is a home directory? (20220605173522)
- What are permissions and why do I care? (20220605174337)
- (Don't bother learning too much octal for now, we will later)
BREAK (20220605180751)
- Change the permissions on a directory or file? (20220605182159)
- Intro to dangers of 'setuid'? (20220605190001)
BREAK (20220605191440)
- How do do things as another user? (20220605192826)
- How do I change user or group of file or directory? (20220605193701)
- What are user and group IDs? (20220605195407)
- How do I remove a directory? (20220605201137)
- How do I recursively change ownership and group? (??)
BREAK (20220605203732)
- How do I move or rename a file or directory?
- How do I copy a file or directory?
- How do I copy a file or directory from another computer?
- What's the stuff in root (
/
)? (20220605212327)
Commands¶
ip -c a
- lookup IP addressesset -o noclobber
- stop from blowing away filesmv foo other
- change file/directoryfoo
name toother
(or move)mv -i foo other
- change file name but protect against overwritescp foo other
- copy file/directoryfoo
name toother
(or move)cp -ar foo other
- copy allfoo
toother
keeping timestampscp foo target:
- copy foo from host to remote target home dir (def)ls -ld
(or with.
) - look directory permission on current directorystat foo
- see all the details about thefoo
inodechmod +x foo
- make foo file executable by user, group, otherchmod o-r foo
- make foo unreadable by otherchown rando foo
- change ownership offoo
torando
chown -R jill:jill olddir
- recursively change ownership/groupsudo su -
- effectively login as root without logging outsudo su - foo
effectively login asfoo
stat -c '%a'
- to see octal permissionscd -
- change into previous directoryecho foo
- write foo to standard outputcat foo
- write content of foo file to standard outputwhich foo
- print the full file path to the executable fools -l $(which sudo)
- list perms forsudo
commandsudo adduser foo
- interactively add a user namedfoo
(not RedHat)sudo deluser foo
- interactively delete a user namedfoo
(not RedHat)sudo passwd foo
- change the password forfoo
passwd
- change own passwordtouch
- create new text file or update last modified time statrmdir foo
- remove an emptyfoo
directoryrm -rf foo
- remove directory or file foo and everything in itgrep jill /etc/passwd
- list only line containingjill
file foo
- tell type of inode
Related¶
- https://picoctf.org/
- https://overthewire.org/wargames/bandit
man 5 passwd