Saturday, July 9, 2016

linux sysadmin interview questions

Most of these questions are known, for which I somewhat apologize. The purpose of this post is to have a collection of questions I consider to be of reasonable to high quality.

Questions are provided in a shortened form in order to reduce repetition. The interviewer is supposed to press the answer with "why", "does it have to be true/false", "what does this depend on" and the like as applicable. The candidate must effectively be told to explain their understanding of the issue at hand. These are not "yes or no" questions.

I'll start off with my own question (I realize that most likely someone else came up with an equivalent):

1. A classic one-liner is of the form: ps auxw | grep foo. Can grep foo appear in the result?

An excellent opportunity to discuss pipes + fork + exec + races.

And now stuff you likely heard at least once:

2. Is cd a shell built-in?

3. A particular server has 20 zombie processes. What do you do?

4. A junior sysadmin says they ran ps and it appears to have hanged and cannot be killed with ctrl+c. You have a ssh session on the affected machine. Diagnose.

ps can really hang due to a multitude of reasons. The (real world!) scenario I like is hang on /proc/<pid>/cmdline read. Note that candidate's ps is also expected to hang.

5. You see a process using up 100% CPU in top. Diagnose.

It can be e.g. an in-house program which stats the same non-existing file for some reason.

6. load average is 500. Diagnose.

Suggested classic is a hung nfs server.

7. Running any binary appears to hang. You got one last operational ssh session. Diagnose.

Only shell built-ins can be used.

8. You are given a binary. How do you find out what it does?

9. Why is suid not honoured when executing scripts?

10. ping crap.org

The classic. If you don't want network talk, I suggest uname.

11. You run strace -p <valid pid> and it does not give you any output. What now?

No comments:

Post a Comment