I created a simple test netns :

sudo ip netns add test

Then I brought up the lo interface.

I'm currently in the home directory of user1, and by executing

sudo ip netns exec test ls -la

I see all the files and directories, however, I can't access a certain directory with

sudo ip netns exec test cd MyDir

It just says: " exec of "cd" failed: No such file or directory "

Here are the access rights the directory I cant access:

drwxr-xr-x 7 user1 user1 4096 Jan 18 20:08 MyDir

Now it goes without saying that I can access MyDir without any issue from ANYWHERE else NO problem ! It also happens with other directories owned and created by user1.

So why is that, what am I doing wrong? I know anything executed with ip netns exec will be executed as root, but is that the issue?

  • It's about the cd command not about ip netns. Try these commands to reproduce your problem without involving ip netns. Compare nice sleep 1 versus nice cd ..
    – A.B
    Jan 25, 2022 at 1:43

1 Answer 1


The cd command was the problem.

Using ls or cat, all is fine.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .