Linux basic Exercises, interview questions (ii)

Source: Internet
Author: User

1, how to view the current user's home directory is what?

Echo $HOME


2, if the setting Umask is 001, then the user defaults to create the directory and file permissions to look like?

The directory created is 766 and the file is 666


3, for security reasons, how to enable others to ping your online server.

Echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all


4, how to prevent others in front of the server by pressing the Ctrl+alt+del forcibly restart the system (hint, carefully see/ETC/INITTAB)

Vi/etc/init/control-alt-delete.conf

Exec/sbin/shutdown-r Now "Control-alt-delete pressed" This item # comment out, save exit;

5, when the server for heavy load operation, you do not want to have a regular user login up, what should you do? Do not cut the network cable.

Touch/etc/nologin

Create a Nologin file, this file is a special file, after the creation of all ordinary users can not log on, after the system maintenance to delete the file, the user can resume login, only the shell login user, the user itself shell for/sbin/nologin can not log into the shell, not be affected;


6, you create a new batch of users, for security reasons, require these users to log on the first time must change the password, how to implement?

Modify the/etc/shadow third column to change the value of the new user to 0.



7, how to change all the files in a directory (without directory) permissions to 644?

Find./-type F | Xargs chmod 644


8, please realize the following requirements: Only allow the use of ordinary account login, and ordinary account login, you can not enter the password to sudo switch to the root account, root is not allowed to telnet.

Vi/etc/sudoers

Add a row user all= (root) nopasswd:/bin/su


Vi/etc/ssh/sshd_config

Permitrootlogin is set to No, root login is not allowed;

Service sshd Restart Restart sshd services in effect;


9, how to make the file can only write can not be deleted? How can I make a file unable to be deleted, renamed, linked, written, or added to the data?

Chattr +a can only write can't delete

Chattr +i cannot delete, rename, write new data;


10. When using LS to view a directory or a file, what does the value of the second column mean? If the value of this column in a directory is 3, how is this 3 obtained?

The second column value indicates that several files use the same inode;

If a directory of this column is 3, we can get it by using Ls-al dir/|grep ' ^d ' |wc-l this command;





This article is from the "Model Student's Learning blog" blog, please be sure to keep this source http://8802265.blog.51cto.com/8792265/1627907

Linux basic Exercises, interview questions (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.