Bash/Linux Flashcards
ls -la
for listing permission
Get-LocalGroup
Get default local groups listed w descriptions
Get-LocalUser
gives the names of users, if they are enabled or not, with description
Get-LocalGroupMember
can see which users are in the group
sudo su -
you become the root user, but not recommended if a mistake has been made
sudo cat /etc/group file
shows which groups or users have sudo accessibility to run commands/unrestricted access
cat /etc/group
shows each group, group password (x means the pw is encrypted), group ID, list of users in the group
cat etc/password
first field is username, password, UID (user ID),
How to reset password in GUI
computer management, local users and groups, select account, properties, then you can ask to reset PW or set it manually for them by selecting set PW
net user cindy ‘some_password’ OR * to then ask for PW for user
OR /logonpasswordchg:yes
to change a users password, set it hidden from sight, or for next login they will have to change it
passwd cindy
changing password for cindy in Linux, you need current PW, then entering a new one
sudo passwd -e cindy
set the password to expire and require a new one in Linux
new -localuser in windows
creates a new user in windows
net user cindy * /add
adds a new user called cindy and asks for the password/hidden in Windows
net user cindy /logonpasswordchg:yes
next login cindy will need to change her password in Windows
net user cindy /del
delete cindy command in Windows
Remove-LocalUser Cindy
removes a local user in Windows
sudo useradd cindy
adding a user in Linux
sudo userdel cindy
deletes a user in Linux
ls -l ~/my_file
listing it using the long flag to see the permissions on the file
- at the beginning is a normal file, D is for directory, the next 9 bits are the permissions grouped in sets of 3
first set is permission of owner,
second set is permission of group,
last is permission of all other users
- means its disabled, otherwise it has rwx (read, write, execute)
chmod u+x my_cool_file
chmod u-x my_cool_file
chmod ugo+r my_cool_file
change the permission by giving executable or x access to the owner or you.
remove a permission with -
add read permissions to our owner, the group that the file belongs to, and to all users and groups
numerical equivalent for rwx (read, write, execute)
4 for read,
2 for write,
1 for execute
chmod 754 my_cool_file
stands for 4+2+1 meaning rwx for the owner,
5 is 4+1 for read and execute for g
if you ls -l /usr/bin/passwd, you get
-rwsr-xr-x 1 root root 54256 May 16 19:35
what does the S in the permissions stand for?
S stands for set UID, you can run permissions as if you were the owner of the file
sudo chmod +t my_folder/
OR
sudo chmod 1755 my_folder/
sticky bit aka this means everyone can add and modify files in the /tmp directory, but only root or the owner can delete the /tmp directory.