Feiniu NAS fnOS: Configuring Password-Less SSH with `sudo`—Say Goodbye to Entering Your Password Every Time

fnOS (Feiniu NAS) SSH: Do you have to enter a password every time you use `sudo` during operations? This article explains how to set up password-less `sudo` using `visudo` and `/etc/sudoers.d`, allowing you to enable password-less access only for specific commands, and includes instructions for verification and revocation.

Anyone who uses a NAS knows that while Feiniu’s fnOS has a very user-friendly web interface, there are always some tasks that can’t be avoided. SSH Command Line: Changing configurations, running Docker, setting up cron jobs, checking system logs… Whenever you type sudo, the system will prompt you to enter the administrator password once. This isn't a problem for a single operation, but if you're writing automation scripts or executing commands in bulk,The password prompt causes the script to freeze., It's just so miserable.

This article provides a step-by-step guide to configuring fnOS. sudo without a password, offers three methods: beginner-friendly visudo Direct Modification Method—Offers the Best Maintainability /etc/sudoers.d The Separate File Method, while also taking security into accountSpecify commands that do not require a passwordLaw. Choose what you need—get it all in one go.

Preface: The Security Limits of Password-Less `sudo`

First, let’s pour a bucket of cold water on this:Using sudo without a password is like turning your administrator account into a "half-root" account.—Anyone who gains access to your SSH session can execute any privileged command without entering a password. Therefore:

  • Recommended only whenHome-use standalone NAS, test virtual machineUse on;
  • In a production environment where SSH is shared by multiple users and open to the public, it is not recommended to enable global passwordless access;
  • If you simply find it a hassle to enter a password when using SSH, I recommend setting upSSH Key-Based Login(This eliminates the need for a login password, not the sudo password), which is much more secure.

Method 3 offers a compromise that balances convenience and safety; we recommend reading through the entire section before proceeding.

Preparation: Verify the username and SSH

fnOS is a deeply customized version of Debian; the first administrator account created during installation (which by default is named something like fnos) isSuper Administrator, which comes with SSH access; we'll use this account as an example for the configuration that follows.

  1. Enable SSH:fnOS Desktop → Settings → SSH; make sure it's enabled and note the port (default 22).
  2. Connect to the NAS using a terminal app (such as Windows Terminal, FinalShell, or Termius), then run whoami Confirm the current username.
  3. Verify that sudo is available: Enter echo "Your password" | sudo -S whoami, capable of outputting root This indicates that administrator privileges are functioning properly (the following two steps are not necessary; skip directly to the corresponding method).

Method 1: Directly Edit with visudo (Beginner-Friendly)

Back up first, then edit:

sudo cp /etc/sudoers /etc/sudoers.bak
sudo visudo

fnOS opens files with nano by default (if you're used to vim, you can run sudo EDITOR=vim visudo). Find this line in the file:

%Administrators ALL=(ALL:ALL) ALL

In itBelowAdd a new line (put fnos (Replace with your username):

fnos ALL=(ALL) NOPASSWD:ALL

Save and exit (nano:Ctrl+O Press Enter to save,Ctrl+X (Exit). Before exiting, visudo automatically performsGrammar Check, If there are any errors, you'll be notified, and the system won't let you save the incorrect configuration.

为什么必须加在 %Administrators 那一行的后面?

The rule matching for `sudo` is"The last match takes effect":When your account matches both an administrator group rule (which requires a password) and a password-less rule, the latter overrides the former. The password-less rule will only take effect if you place it after the group rule; if you place it before it, you’ll still be prompted to enter a password—this is a common pitfall for beginners.

Method 2: Standalone sudoers.d File (Recommended)

A more standard practice is to include the rules in /etc/sudoers.d/ A separate file under this directory; do not modify the main configuration:

echo 'fnos ALL=(ALL) NOPASSWD:ALL' | sudo tee /etc/sudoers.d/90-nopasswd-fnos
sudo chmod 440 /etc/sudoers.d/90-nopasswd-fnos

Compared to Method 1, it has three distinct advantages:

  • System upgrades do not overwrite existing data:fnOS updates do not affect files you've added to the /etc/sudoers.d directory;
  • Revocation Made Easy with One Click:sudo rm /etc/sudoers.d/90-nopasswd-fnos That is, restore it to its original state;
  • Clear Separation: Keep the main configuration file clean at all times so that issues are immediately apparent when troubleshooting.

Before the filename 90- This is a sort number; the higher the number, the later it is loaded. Remember that rule files must begin with a number andDo not include a period at the end., otherwise it will be ignored.

Method 3: Exempt Only Specific Commands from Password Requirements (Highly Recommended)

A system-wide password-less setup carries significant risks. If you just want to stop being prompted for a password when running a few commands you use frequently, you canDown to the command:

sudo tee /etc/sudoers.d/90-fnos-cmds <<'EOF'
fnos ALL=(ALL) NOPASSWD: /usr/bin/systemctl, /sbin/reboot, /sbin/poweroff
EOF
sudo chmod 440 /etc/sudoers.d/90-fnos-cmds

The example above applies only to systemctl(Start-Stop Service),reboot、poweroff These three commands do not require a password; all other `sudo` commands still require a password. Add the ones you need, using which command_name Just look up the absolute path and enter it (for example, Docker users often add /usr/bin/docker)。

Verify whether it is in effect

After completing the configuration, open a new SSH session and run:

sudo -l

You can see it in the output (root) NOPASSWD: ALL(Method 1/2) or the corresponding command whitelist (Method 3) indicates that the rule is now in effect. Then simply type sudo whoami, No password required; output directly root, and that's it—all done.

What should I do if I want to cancel?

  • Method 1: Again sudo visudo, Just delete the line you added (or restore the backup) sudo cp /etc/sudoers.bak /etc/sudoers);
  • Method 2/3: Delete the corresponding rule file directly:sudo rm /etc/sudoers.d/90-nopasswd-fnos。

Troubleshooting Common Issues

1. Even after adding NOPASSWD, a password is still required

Nine out of ten areOrder of RulesQuestion: The password-free row must be located %Administrators ALL=(ALL:ALL) ALL Next, check to see if the username was entered incorrectly and whether you’re logged in to the correct account.

2. The message “xxx is not in the sudoers file” appears”

This indicates that the current account is not in the admin group and does not have a corresponding sudoers rule. fnOS'sRegular users do not have sudo privileges by default., Please use the first administrator account created during installation, or promote that user to administrator in System Settings.

3. What should I do if I accidentally mess up the sudoers file?

visudo includes built-in syntax checking, so saving normally shouldn't cause any errors; if you ever find yourself in a situation where sudo doesn't work at all, don't panic:

  • If you can still run `sudo` (in some cases), use sudo visudo -c Check the syntax and locate the line with the error;
  • The entire sudo command is broken; use pkexec visudo Repair using graphical mode (provided the desktop environment is available);
  • Last resort: Use a USB drive with fnOS to boot into rescue/single-user mode, mount the system drive, and manually revert the settings. /etc/sudoers. If you make it a habit to back up your work before making changes, you’ll rarely find yourself in this situation.

Summary

Configuring password-less sudo on Feiniu fnOS isn't complicated; it basically comes down to one line:After the administrator group rule, add a NOPASSWD rule for your username.. I highly recommend it.Method 3 (Specifying Commands Without a Password)或Method 2 (Standalone sudoers.d File), balancing ease of use and safety.

If you're still working on setting up Feiniu, you might find these articles helpful:How Smoothly Can Old Hardware Run? A Guide to Avoiding Pitfalls When Tinkering with a Feiniu NAS Using the D525、You Can Still Have a Blast for Free! Without Spending a Dime, FlyNiu NAS Remote Access Still Runs at Full Speed and Launches Instantly. If you found this helpful, feel free to bookmark and share it, and we’d love to hear about your own tinkering experiences in the comments section.

Related Reading:

Original article by Tech.laowang. If you wish to repost this article, please credit the source: https://techlaowang.com/en/fnos-sudo-ssh/

Like (2)
Tech.laowang's profile pictureTech.laowang
Previous November 30, 2025, 2:34 a.m.
Next September 5, 2026, 11:30 a.m.

Related Recommendations

Explore the world of technology and gain access to software solutions and expert insights on accessing the internet from abroad—your trusted technology resource platform!