Linux_book Flashcards

1
Q

What is the distinction between free software and open source software given by Richard
Stallman, the founder of the free software movement?

A

Open source is a development methodology; free software is a social movement. Free software refers to
freedom rather than to software that has no cost associated with it.

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

What is one of the main advantages of Linux that has enabled it to be applied to many
different computing roles?

A

Linux is highly extensible, which makes it an excellent choice for computing roles as diverse as servers,
workstations, mainframes, and mobile devices.

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

True or false? There is a single Linux master distribution from which all other Linux distributions
are derived.

A

False. There is no single master Linux distribution. There are several top-level (not derived from another
distribution) distributions from which others are derived. Slackware, Debian, and Red Hat Enterprise Linux
are examples of top-level distributions.

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

Which Unix philosophy states that developers should create software that is limited in
functionality because it’s easier to use and to maintain?

A

Worse is better. The assumption is that limited functionality is worse than creating software that does
everything.

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

Linux incorporates software tools from which of the following sources?

Unix
The GNU Project
Berkeley Software Distribution (BSD)
macOS

A

The GNU Project

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

Which of the following statements about free and open source
software (FOSS) are true? (Choose two.)

Anyone can access the source code.
The author cannot charge a price for the source code.
Anyone can modify the source code.
The source code can only be distributed to a public developer community.

A

Anyone can access the source code.

Anyone can modify the source code.

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

Which of the following FOSS licenses is the Linux kernel released
under?

GNU General Public License (GPL) version 2
GNU GPL version 3
MIT License
Apache License 2.0

A

GNU General Public License (GPL) version 2

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

True or false? Linux distributions can include proprietary software by
default.
True
False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
Which of the following Linux distributions is the no-cost version of Red
Hat Enterprise Linux (RHEL)?
Ubuntu
Fedora
openSUSE
CentOS
A

CentOS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
Which of the following characteristics are emphasized by the Unix design
philosophy? (Choose two.)
Modularity
Stability
Complexity
Simplicity
A

Modularity

Simplicity

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

True or false? Linux is Unix-like in its design.
True
False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
Which of the following computing roles does Linux dominate in market share?
(Choose three.)
Workstations
Web servers
Mobile devices
Supercomputers
A

Web servers
Mobile devices
Supercomputers

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

True or false? In Linux,

Equipment.txt and equipment.txt refer to the
same file.

A

False. Linux file names are case-sensitive. These are two different files.

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

Which command enables a user to log in to a system with their own credentials, and then to become the root user to perform administrative tasks?

A

Su - The su command enables an authorized user to become the root user.

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

A fellow administrator calls you and needs you to check the /etc/shadow file for a new user’s entry, confirming that it indeed exists. How would you look at the contents of the /etc/shadow file without the possibility of changing the file?

A

1) su – 2) cat /etc/shadow —You first have to become the root user because
the /etc/shadow file can only be read as root. To look at the file without the possibility of
altering its contents, use the cat command to list its contents to the screen.

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

You need to quickly create an empty file (log.txt ) so that an application can copy data into it. Which command can you use to create the file?

A

touch log.txt

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

You recall that a few days ago, you ran a command that helped you find a filtered list of files on the file system. You don’t remember the command’s somewhat complex syntax. How can you reproduce the command without searching the Internet for the correct syntax again?

A

Use the Up Arrow key until you find it and then press Enter to execute it. The Up
Arrow key scrolls back, one command at a time, through your command history.

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

Since Linux is generally community (user) supported, name three sources of Linux documentation.

A

Any three of the following: Manual pages, built-in help commands, online
documentation projects, Usenet newsgroups, Internet mailing lists, question and
answer websites, forums and social media, and books and other print resources.

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

To access complete local documentation, which command can you enter at the command-line to access extensive usage information on the cp (copy) command?

A

man cp

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

A coworker sends you an instant message and asks you how to appropriately format a manual page for the mv command so that she can send it to the printer and get readable output. What command can she enter?

A

man –t mv

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

Which online documentation site provides a comprehensive resource for Linux documentation including manual pages, FAQs, HOWTOs, and
other types of documentation?

A

The Linux Documentation Project (https://www.tldp.org)

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

If you know the name of a command and want to know what its function is, which command would you use to find out?

A

Whatis

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

Given what you’ve read in the man page for grep so far, answer what you think the following command does: grep -i hello myfile

A

This command will return any lines in the file myfile that contain the text “hello”,
no matter what case the text is in (case insensitive).

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

Name the three types of Linux user accounts.

A

Root user (superuser), standard user, and service.

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

You need to add an administrator to the /etc/sudoers file to give them the ability to use the sudo command. Which command must you use to add users to the /etc/sudoers file?

A

You must use visudo since you cannot edit the /etc/sudoers file directly with Vim or
other text editors.

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

Why is it a security best practice to log onto a Linux system with a regular user account rather than with the root user account?

A

The primary reason is to prevent harmful mistakes from happening to the system through errant
commands such as rm (remove). Users who can use the sudo command should do so on an
individual command basis to perform necessary tasks with elevated privileges, while remaining in
their user shells for other functions.

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

Why is it important to put the principle of least privilege into practice?

A

System security is greatly enhanced by only granting users the minimum amount of rights and
permissions they require to perform a task.

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

Describe the difference between using the su command and using the sudo
command to perform administrative tasks.

A

The su command enables an authorized user to become the root user by switching to the root
user account in a complete root-owned shell. This is handy for the administrator but very dangerous because of the potential for human error. The sudo command enables an authorized user to issue individual commands as the root (or other user), limiting potential damage to the system.

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

In which file are user accounts stored?

A

/etc/passwd

30
Q

What are the three commands used to properly edit the /etc/passwd file?

A

useradd, usermod, and userdel

31
Q

In which file are hashed passwords stored?

A

/etc/shadow

32
Q

Why are /etc/passwd and /etc/shadow different files?

A

The /etc/passwd file stores user account details such as user names, default shell, home directory, and group names. The /etc/shadow file contains the
hashed passwords that are only readable by the root user account, whereas /etc/passwd is readable by everyone. Having a separate file for each, with different permissions, strengthens security.

33
Q

With which command can you change the default user shell to the KornShell for user bsmith ?

A

sudo usermod -s /bin/ksh bsmith

34
Q

Why do administrators, classes, and best practices state that you should manage users by managing groups?

A

Managing groups simplifies user administration. Rather than granting explicit permissions to users on an individual basis, you grant them to groups and add users to those groups.

35
Q

Which file contains the groups and user members of those groups?

A

/etc/group

36
Q

Which three commands does a system administrator use to properly edit a Linux system’s group file?

A

groupadd, groupmod, and groupdel

37
Q

Which command does a system administrator use to add a user (bsmith ) to an existing group (finance)?

A

sudo usermod -aG finance bsmith

38
Q

True or false? The groupmod command is used to change the name of an existing
group.

A

True.

39
Q

As a Linux administrator, you might often switch accounts from yours to the root user or to other user accounts to perform tasks. Which command can you issue to find out which user account you’re currently using?

A

Whoami

40
Q

You suspect that a hardware failure is imminent and you need to reboot the system to ensure that everything is working properly or to force a failure. Before issuing the reboot command, which command can you use to check to see if other users are logged onto the system?

A

Who

41
Q

A user reports that she was working on an important script when the system rebooted at approximately 6:30 P.M. last night. No warning was given. How can
you find out who was logged into the system at that time and who could have rebooted the system without warning?

A

The last command will inform you as to who was logged into the system. If an administrator
rebooted the system, you’ll be able to identify him or her from the entries displayed. If the system
crashed, last will also provide that information. Further investigation of systems logs may be
required in the event of a crash.

42
Q

As a system administrator, why might you issue the id command?

A

The id command displays group information at a glance in an easy-to-read format.

43
Q

As an administrator, you might need to reboot a system or otherwise perform maintenance. Which command would you issue to not only view logged on users
but also their current activity?

A

The w command displays idle time and the amount of CPU time consumed by user-owned processes. This information will tell you if it’s safe to reboot a system or if you should ask users to log off first.

44
Q

True or false? Using a dot at the beginning of a file name makes the file more secure.

A

False. The file is hidden from normal view as a matter of organization, but does nothing for
security.

45
Q

What is the primary difference between the .bashrc and the .bash_profile files?

A

The .bash_profile file is executed upon first login to the system, and .bashrc is executed upon subsequent logins.

46
Q

Which directory’s contents are copied to the user’s home directory upon account creation?

A

/etc/skel

47
Q

Which file forces system-wide customizations for all users on a system that a user cannot change?

A

/etc/profile

48
Q

Where should administrators set system-wide variables on a Linux system rather than editing the /etc/profile file directly?

A

In scripts within the /etc/profile.d directory.

49
Q

Multiple users have complained about file access in a shared directory, but you’ve checked your daily backup reports and there are no corrupt files.
Which command can you issue in the directory in question to
investigate the problem further?

A

ls -l —This command displays the permissions of all files in the directory to
help you sort out the problem. It’s likely that the directory’s group permissions are
incorrectly set.

50
Q

A group of system administrators were discussing file permissions and decided that setting a particular root-owned text file to read-only for everyone is a best practice. What do the permissions for this file look like?

A

Either 664 or rw-rw-r– is correct.

51
Q

A user cannot execute a script (collect.sh ) she created and has sent you the contents of the script via email to inspect. After looking at the script, you determine the script is correctly written but permissions are the problem. What command can you issue to adjust the file’s permissions as necessary?

A

chmod u+x collect.sh

52
Q

A user changed the permissions of a script (myscript.sh ) in a shared directory. The user is curious why everyone can execute the script if the user owns the script and everyone else only has read access. To make the script executable, what command did the user mistakenly issue?

A

chmod +x myscript.sh —The permissions changed to rwxrwxr-x or 775, which gives everyone execute permission. To limit execute permission to the user and group only, the command should have been:

chmod ug+x myscript.sh

53
Q

Your team lead is tired of receiving help desk tickets to restore deleted files from a directory that contains hundreds of files and subdirectories. She decides to have you fix the problem by making all of the files read-only. How do you change all the files to read-only without having to traverse each directory?

A

chmod -R 644 *

—This command changes all files in the current directory to 644 recursively.

54
Q

A user (Bob Smith—username: bsmith ) calls you to request that you restore a group of files he accidentally deleted from his home directory. You copy the files for him but he later complains that he can no longer edit the files. What do you need to do so that he can edit his files?

A

You need to change ownership of the files to him. Change user and group ownership recursively
so that Bob owns all files and directories.

For example: sudo chown -R bsmith:bsmith *

55
Q

Gina wants to share some marketing files with two other members of her team but doesn’t want them to access those files in her home directory. She also wants the directory and its files to only be available to the Marketing group. What steps can you take as an administrator to accomplish this request?

A

1) You need to create a new group (mkt): sudo groupadd mkt

2) Add users to the
group: sudo usermod -aG mkt gina linda mark

3) Create the shared directory: sudo mkdir /opt/marketing

4) Change group ownership to mkt:
sudo chgrp mkt /opt/marketing

5) Change permissions so that the Marketing
group has full control of the directory and its contents and remove everyone else: sudo
chmod 770 /opt/marketing

56
Q

What command is equivalent to issuing chown :mygrp file1 ?

A

chgrp mygrp file1

—Both commands change the file’s group to mygrp without changing the owner.

57
Q

As an administrator, you’ve created a shared directory and made the necessary permissions changes to allow a group of users access to that directory. You’ve also added users to the group. When a user (susan ) who is a member of the group creates a file in the shared directory, what user and group permissions will the new file have?

A

The file’s user and group ownership will both be susan.

58
Q

What must a user do in a shared directory to ensure that each group member has full read and write access to files they create?

A

Change the group ownership to the group:

chgrp accounting salaries.txt —

The user doesn’t have to be root or use sudo to change group ownership because the file creator is the file’s user and group owner, and therefore may change its permissions at will.

59
Q

The Marketing manager contacts you stating that the shared directory you set up for the Marketing group ( /opt/marketing ) works, but not exactly like they’d planned. When one of the group members creates a file in the directory, the file takes on the user’s user and group permissions.

For
example, when Linda creates a new file, the permissions are

–rwrw-r– linda linda .

The manager wants the files to all retain the mkt group permission, if possible, rather than having the users change the group themselves. What action can you take to fulfill this request?

A

sudo chmod -R g+s /opt/marketing

—By setting the SGID on the directory, every file created by anyone in the mkt group will have the mkt group ownership.

60
Q

Gina, a member of the Marketing group, has decided that she wants her files protected so that only she can delete them, although other Marketing group members need to be able to work on and edit the files. What can she do to fix the problem of others deleting her files?

A

You can show Gina the following command to set the sticky bit on her files:

chmod +t filename.txt —This command also works on directories

61
Q

Ruth has searched for a solution to her problem: A few of her training documents keep getting changed or removed by system administrators removing files that haven’t been accessed in excess of 180 days.

She has found that a file can be made immutable, but she cannot make her own files immutable and needs your assistance. How can you make the files /home/ruth/training1_doc.txt and /home/ruth/training2_doc.txt immutable?

A

sudo chattr +i /home/ruth/training*_doc.txt

62
Q

A user, John, opened a ticket complaining that he has files in his home directory that he cannot remove, although they are his files and he is the user and group owner. He requests that you remove the files /home/john/billing1.txt , billing2.txt , and summary.txt . However, when you attempt to remove the files, you receive an error that you cannot remove the files as the root user.

What is a possible resolution for John?

A

You can issue the lsattr command to see if immutable flag has been set on
those files. If it has, you can resolve the problem by removing the immutable flag
and then removing the files:

1) sudo chattr –i /home/john/billing1.txt
2) sudo chattr –i /home/john/billing2.txt
3) sudo chattr –i /home/john/summary.txt
4) sudo rm /home/john/billing1.txt
5) sudo rm /home/john/billing2.txt
6) sudo rm /home/john/summary.txt

63
Q

You created a shared directory for the Marketing planners, Linda and Mark, named /opt/MPlans . Their group, mplan , has exclusive access to this directory. No other user can access the directory or its contents. Linda decides that Gina needs read-only access to a single file, history.txt , inside the /opt/MPlans directory. Is this kind of restrictive access possible? If so, how
can you grant it to Gina?

A

Yes, it is possible through ACLs. First, grant Gina read and execute access to the directory:

setfacl -m u:gina:rx /opt/MPlans

and then, set read access to the history.txt file inside the MPlans directory:

setfacl -m u:gina:r /opt/MPlans/history.txt

—You can check your work by executing getfacl on the
directory and its contents.

64
Q

Rose Stanley opened a ticket indicating that she is denied the ability to delete a directory. She confirmed with the service desk that she has write permission to the directory. What suggestion would you make to address the issue?

A

Users also need the execute permission to remove a directory.

65
Q

Jerry Robinson received an access denied message on a file. He told the service desk that the user permissions indicate the owner has read access. What suggestion would you make to address the issue?

A

Check to see if Jerry Robinson’s account is the owner of the file, and if not, make him the owner if
he should be.

66
Q

Rose Stanley received an access denied message on a file. She used the ls -l command to discover what group had been granted access to the file. She believed she should be able to access the file. What suggestion would you make to address the issue?

A

Use the id command with Rose Stanley’s account to ensure she is a member of the group
specified by the file’s permissions.

67
Q

Jerry Robinson cannot use the cd command to navigate into a particular directory. He told the service desk that he used ls -l to see what group is associated with the file. He also confirmed that the group is listed as having read access to the directory. He then used the id command to confirm he is a member of that group. What suggestion would you make to address this issue?

A

Users also need the execute permission to change into a directory.

68
Q

A group with a shared directory set up by another administrator is having several problems with permissions in that directory. You’ve been asked to investigate. Which commands can you use to check existing permissions to help assess the current setup?

A

1) ls -al
2) getfacl
3) lsattr

—These commands will give you a good perspective on
permissions, ACLs, and any attributes that have been set on the shared directory and files.

69
Q

A user complains that a script that she created and has full access to (rwxrwx— ) is not executing for her. What is the problem with this script?

A

The execute bit was removed from the script by the ACL. It’s possible that the script consumed
too many resources and an administrator likely removed execute access to it.

70
Q

Bob opens a ticket stating that he receives a permission denied error when trying to cd into /opt/Finance . Bob is a member of the FinanceDept group. What is the problem with Bob’s access?

A

While Bob is part of the FinanceDept group and can access all other FinanceDept group assets, he cannot use /opt/Finance because he doesn’t have access via ACLs to that directory.