I can't edit nor list vsftpd.conf as root

As you can see. I am root. I can see the file with a wildcard ( until I hit the “.” ) but cannot list nor edit the fullname

[root@offroar etc]# whoami
root
[root@offroar etc]# l vsftpd*
total 36
-rwxr--r--.   1 root root   352 Feb  3  2019 vsftpd_conf_migrate.sh
-rw-------.   1 root root  5098 Feb  3  2019 vsftpd.conf
-rw-------.   1 root root   361 Feb  3  2019 user_list
-rw-------.   1 root root   125 Feb  3  2019 ftpusers
drwxr-xr-x.   2 root root  4096 Sep 20  2020 .
drwxr-xr-x. 159 root root 12288 Dec  4 14:20 ..
[root@offroar etc]# l vsftpd.*
ls: cannot access 'vsftpd.*': No such file or directory
[root@offroar etc]# l vsftpd.conf
ls: cannot access 'vsftpd.*': No such file or directory
1 Like

‘l’ by itself is not a native bash command. I would suspect that you have that configured as an alias and they do not always work as expected unless you have been very careful in the way the alias is constructed.

Please show us the output of alias also done as root.

If you have that as an alias for your regular user and have switched to root without also switching the environment it can have an effect as well.

2 Likes

The file you want to access does not belong the current working directory.
Change the working directory or specify the full path to the file.

1 Like

Given the output, I’m assuming that l is an alias to ls -l. I agree with @computersavvy that it’s hard to know what’s going on without knowing exactly what that alias does. But, I do have a guess as to what’s happening here.

If you have a directory named vsftpd under the etc directory you are working from, ls -l vsftpd* will expand to ls -l vsftpd/ — that is, it matches the directory name — and so will show you the contents of that directory. So, I bet ls -l vsftpd/vsftpd.conf, or at least ls -l vsftpd*/vsftpd.*, will work.

One thing you could do to prevent this confusion in the future is to make l be ls -ld, so that it will list directory names rather than contents. But that might be frustrating other times when looking in directories is what you want to do.

2 Likes

On my laptop vsftd is open for user, (no root necessary for reading or finding)
Found it using Files/Nautilus.
it is in /usr/share/doc/python3-pycurl/tests

But sudo ls -ld vsftpd.conf does find the file.
And sudo ls -ld vsftpd* also does find it.

I think @mattdm clued in on the problem, one we all commonly trip over. From your etc directory where you were, do ls -ld vsftpd*. The “d” option won’t expand the directory, so @mattdm suspects you’ll see drwxr-xr-x ... vsftpd or similar as a directory.
Another approach would be to run find . -name vsfptd.conf which will explore from . and show the path to your file. And if you use the find command and want to use * or pattern matching metacharacters, be sure to put the file search name in quotes, -name "vsftpd*" for example, otherwise bash will do the matching and find won’t see it.

3 Likes

Thanks very much for your answers. And I do apologise, the alias for “l” is simply “ls -altr”. It does a simple directory listing. ( I noticed the “l” as a potential problem after I posted … ).

There is nothing funny here. The file exists in the /etc directory, not a subdir. And I can see it using a wildcard until it specifies the file too precisely. This is the result as root:

[aurel@offroar etc]$ ls vsftpd*
ftpusers  user_list  vsftpd.conf  vsftpd_conf_migrate.sh
[aurel@offroar etc]$ ls vsftpd.*
ls: cannot access 'vsftpd.*': No such file or directory
[aurel@offroar etc]$ ls vsftpd.conf
ls: cannot access 'vsftpd.conf': No such file or directory
[aurel@offroar etc]$

No, it should be /etc/vsftpd/vsftpd.conf.

You are listing the sub-directory that matches the globbing.

2 Likes

Can you please humor me and add -d to those commands and see what they do?

1 Like

Thanks Very much for your answers. I would like to apologize for being dyslexic.

THE ANSWERS WERE CORRECT. The vsftpd is a DIRECTORY in /etc. And the “ls” command was looking in that directory not in /etc as I had assumed.

Thank you very much for pointing this out to me.

2 Likes