Linux and Unix: SSH, sudo and Least Privilege
On this page
In this lesson, you will learn:
- SSH password vs SSH key
- Why some commands need sudo
- Least privilege for Linux
π Quick look back: Last time: Windows: WMI and PowerShell Access. You learned how Windows discovery works and what svc-snow-disc needs.
1 The Problem: Root Access Is Too Much, No sudo Is Too Little
Two bad options for the Linux account:
- Root access: Discovery could change anything.
- No sudo: some commands fail, and data is missing.
π The fix: Use a normal account with an SSH key and a short sudo list for the commands that need it.

2 Why sudo
Some details, like hardware serial numbers, need extra rights to read. sudo lets a normal user run a named command with those rights.
Key term: SSH key
A pair of files used instead of a password. The private key stays in ServiceNow.
Key term: sudo
Lets a user run a specific command with extra rights.
3 In the credential
- Type: SSH private key.
- User: snowdisc.
- The private key, stored encrypted.
- sudo is used for the commands that need it.
4 Project Clear View: How We Implemented It
π Situation: Priya built snowdisc with the tested sudo list.
π§ Decision: Create the SSH key credential and test it.
π οΈ Steps we took:
- Priya generated the key pair and placed the public key on the servers.
- Created SNWR Linux Discovery (SSH private key) on snwrtest.
- Tested against snwr-mail-01 and snwr-db-01.
- Checked serial numbers came back.
β What we verified:
- Login and all commands worked on RHEL 8 and 9.
- Serial numbers were returned.
π Evidence: SNWR Linux Discovery in the credential register.
5 Quick recap
- Use an SSH key for Linux, not a password.
- sudo lets named commands run with extra rights.
- Keep the sudo list short and read-only.
- Never use root.
6 Check yourself
Think of your answer first. Then tap to check.
1 Why an SSH key instead of a password? Show answer
Keys are harder to guess and easy to rotate.
2 Why does Discovery need sudo on Linux? Show answer
Some details, like serial numbers, need extra rights to read.
3 Where does the private key live? Show answer
In the ServiceNow credential, stored encrypted.
Nice work! SNWR’s Linux credential works. π
Next up: SNMP v1, v2c and v3 Credentials
Was this lesson helpful?
Please log in to share lesson feedback.
Have a question or doubt?
Ask here and get help from instructors and fellow learners.
Only logged-in learners can post.




