0

I know I have the file /etc/ssh/sshd_config.
I wanted to find it because I didn't remember the path.

Referring to this, https://linux.die.net/man/1/find , and some comments of people with the same problem using "find" I tried: find / sshd_config and sudo find / sshd_config and find /etc sshd_config and find /etc/ssh sshd_config

Result: No such file or directory

enter image description here

I'd like to know why find does not find that file. I also like to know if it is not the right command, which command is the right one ti find a file when we don't know the path (also using wildcard will help).

1

You need an expression. A simple one, case-insensitive name: find /etc -iname sshd_config. The man page shows you all the other expressions you can use.

2
  • I though -iname was a parameter for case insensitive name and just the name was enough as expression. Thanks. (I found it needs sudo too)
    – Alex 75
    Apr 29 '20 at 20:00
  • Noop, you need -name or -iname to search for a name. Also, You don't need to be root (sudo) to find /etc/ssh/sshd_config since /etc, /etc/ssh as well as /etc/ssh/sshd_config have the read permission set for 'other'. You'll just get a lot of error messages about directories your not allowed to read and therefore should redirect stderr to /dev/null. (e.g. find / -name sshd_config 2>/dev/null)
    – bey0nd
    Apr 29 '20 at 20:45
1

You just need to add -name parameter

find /etc/ssh -name sshd_config should work just fine

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.