more nix Flashcards

1
Q

What command shows you all the yum repos?

A

yum repolist all

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What command shows you all the enabled yum repos?

A

yum repolist
or
yum repolist enabled

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In what directory can you read all the repo lists in order to enable one and disable another and so forth?

A

cat /etc/yum.repos.d

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What’s the command for adding a new yum repo

A

yum-config-manager –add-repo=url

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Command for checking linux version?

A

lsb_release -d
cat /etc/os-release
hostnamectl

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Command to disable a specific repo?

A

yum-config-manager –disable repoidhere(thisisaname)

or

go into the file for that repo and change “enabled” to 0 instead of 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Get the exact location of the executing thing of a PID

A

ll /proc/PID/exe

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

list several ways to get information about what’s going on with a port

A
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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How could you test a site before dns is ready and resolving?

A

modify the /etc/hosts file to point to a specific place by ip

examples:
actualipaddress somefakedomain.com
255.43.32.21 cpanel.rocks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you change the hostname?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Two ways to check the current system runlevel

A

runlevel

who -r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Check what services are running on startup

A

chkconfig or chkconfig –list for cent6

systemctl list-unit-files for cent7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

make a service run on startup

A

chkconfig servicename on

chkconfig sshd on

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

make a service not run on startup for your current runlevel

A

chkconfig servicename off
chkconfig sshd off

systemctl disable servicename

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

remove a service from the chkconfig list

A

chkconfig –del servicename

chkconfig –del sshd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

add a service to the chkconfig list

A

chkconfig –add servicename

chkconfig –add sshd

17
Q

check the info azbout a current systems startup in chkconfig

A

chkconfig –list servicename

chkconfig –list sshd

18
Q

how to change the current runlevel

A

telinit #

telinit 1
telinit 6

19
Q

what are the differnet linux runleveles

A

1-6

20
Q

how do you check the default runlevel that a system will boot into

A

/etc/inittab for cent6

and look for id:#:initdefault:

systemctl get-default for cent7

21
Q

What configuration files can you use to filter incoming network traffic over TCP?

A

/etc/hosts.allow

/etc/hosts.deny

22
Q

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

A

/etc/at.allow OR /etc/at.deny

23
Q

How do you control access to crontab?

A

/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.
24
Q

What do umask permissions do?

A

They define the default permissions on files and directories when they are created

25
Q

List crontabs for a specific user

A

crontab -u user -l

26
Q

list crontabs for user that you’re logged in as

A

crontab -l

27
Q

How might you search for config files for a service?

A

rpm -qc servicename
rpm -qc openssh
rpm -qc httpd