more nix Flashcards
What command shows you all the yum repos?
yum repolist all
What command shows you all the enabled yum repos?
yum repolist
or
yum repolist enabled
In what directory can you read all the repo lists in order to enable one and disable another and so forth?
cat /etc/yum.repos.d
What’s the command for adding a new yum repo
yum-config-manager –add-repo=url
Command for checking linux version?
lsb_release -d
cat /etc/os-release
hostnamectl
Command to disable a specific repo?
yum-config-manager –disable repoidhere(thisisaname)
or
go into the file for that repo and change “enabled” to 0 instead of 1
Get the exact location of the executing thing of a PID
ll /proc/PID/exe
list several ways to get information about what’s going on with a port
lsof -i :22 netstat -tunlpe | grep :22 netstat -anp | grep :22 fuser -v 22/tcp cat /etc/services | grep 22
----- ss -tunlpe | grep :22 lsof -i -P -n | grep :22 iptables -L -n cat /etc/sysconfig/iptables
How could you test a site before dns is ready and resolving?
modify the /etc/hosts file to point to a specific place by ip
examples:
actualipaddress somefakedomain.com
255.43.32.21 cpanel.rocks
How do you change the hostname?
vim /etc/sysconfig/network
change the HOSTNAME in there
then go around and fix up the /etc/hosts file to reflect your change - althought your hostname will change whether or not you fix this
Two ways to check the current system runlevel
runlevel
who -r
Check what services are running on startup
chkconfig or chkconfig –list for cent6
systemctl list-unit-files for cent7
make a service run on startup
chkconfig servicename on
chkconfig sshd on
make a service not run on startup for your current runlevel
chkconfig servicename off
chkconfig sshd off
systemctl disable servicename
remove a service from the chkconfig list
chkconfig –del servicename
chkconfig –del sshd
add a service to the chkconfig list
chkconfig –add servicename
chkconfig –add sshd
check the info azbout a current systems startup in chkconfig
chkconfig –list servicename
chkconfig –list sshd
how to change the current runlevel
telinit #
telinit 1
telinit 6
what are the differnet linux runleveles
1-6
how do you check the default runlevel that a system will boot into
/etc/inittab for cent6
and look for id:#:initdefault:
systemctl get-default for cent7
What configuration files can you use to filter incoming network traffic over TCP?
/etc/hosts.allow
/etc/hosts.deny
What configuration files can you use to restrict the use of the at command, which is a command that lets you do something at a single specific time
/etc/at.allow OR /etc/at.deny
How do you control access to crontab?
/etc/cron.allow
/etc/cron.deny
If cron.allow exists, only the users who are listed in this file can create, edit, display, or remove crontab files.
If cron.allow does not exist, all users can submit crontab files, except for users who are listed in cron.deny.
If neither cron.allow nor cron.deny exists, superuser privileges are required to run the crontab command.
According to the man page cron does not check cron.allow and cron.deny. If the jobs were already present in the crontab database, then cron will run them.
/etc/cron.deny and /etc/cron.allow only decide who can use the crontab command. From the man page:
For classical crontab there exists cron.allow and cron.deny files. If cron.allow file exists, then you must be listed therein in order to be allowed to use this command. If the cron.allow file does not exist but the cron.deny file does exist, then you must not be listed in the cron.deny file in order to use this command.
What do umask permissions do?
They define the default permissions on files and directories when they are created
List crontabs for a specific user
crontab -u user -l
list crontabs for user that you’re logged in as
crontab -l
How might you search for config files for a service?
rpm -qc servicename
rpm -qc openssh
rpm -qc httpd