I am running FreeBSD 10.2 and used the Let's Encrypt py27-certbot package to create an SSL Certificate.

Now I want to access that Certificate, however when I attempt to run

sudo cd /usr/local/etc/letsencrypt/live/ 

I am unable to access it (after the command runs, I am in the same directory I ran cd from.)

Shouldn't root be able to access any file (especially one it created?)

  • 1
    sudo, like shell parentheses, pipeline (usually) or script or many other tools like env nohup parallel, runs a command you give it in a subshell. Any change made in a subshell does not affect the parent shell. Changing the working directory olf a subshell does not affect the parent. Setting an env var (like PATH) in a subshell does not affect the parent. Setting a shell option in a subshell does not affect the parent. Setting a ulimit in a subshell does not affect the parent. Etc, etc, etc. – dave_thompson_085 Sep 7 '16 at 11:04

Try to become root (sudo su -) and then access the contents of the file/folder.

Using sudo elevates your permissions only temporarily. If you are not a member of a group that has execute permissions on a directory you will [not] be allowed to enter that directory. Below, I have removed the execute bit from the permissions of group wheel, of which this user is a member. (previously drwxr-xr-x)

drwxr--r-x   2 root  wheel       128 Sep  1 18:48 zfs
[user@host /etc]$ sudo cd zfs
[user@host /etc]$

I am able to execute the command sudo cd zfs and it runs fine. But when the command completes I find that my working path is not inside the zfs directory.

Verify the permissions of the directory that you are attempting to enter. The user or member of the group must have the execute permission.

  • Thanks, that is exactly what the problem was (and explains some issues I've had in the past.) – Brandon Bradley Sep 3 '16 at 17:00
  • I am very happy to help! I assume the directory permissions were 700 or rwx------. Is that correct? You'd certainly want to keep your ssl stuff restricted to only the most necessary access. – aeiounix Sep 3 '16 at 17:04
  • It was actually 400. To renew the key though, I would need that to be writable yes? – Brandon Bradley Sep 3 '16 at 17:11
  • If you log into root you will be able to just get some work done. I just played with this a bit and root doesn't need the execute permission to enter a directory, or the write permission alter the contents. I would have guess that acls should apply to root in some manner but that doesn't appear to be the case. lol – aeiounix Sep 3 '16 at 17:24

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.