Make directory command not working

15,629

Actually namu@ubuntu:/$ mkdir file means you are currently in root directory as namu user. Now to make any changes to this location you need root permission (although you should not make changes in root(/) directory). You could use super user privileges to make a new folder, by sudo mkdir by assigning you root user privilege after prompting for the password.

Share:
15,629

Related videos on Youtube

user175925
Author by

user175925

Updated on September 18, 2022

Comments

  • user175925
    user175925 over 1 year

    I am new to the Ubuntu. I have logged in as guest then switch to namu user and want to make directory but get error as follows:

    gest@ubuntu:~$ su namu
    Password: 
    namu@ubuntu:/home/gest$ cd ..
    namu@ubuntu:/home$ cd ..
    namu@ubuntu:/$ mkdir file
    mkdir: cannot create directory ‘file’: Permission denied
    namu@ubuntu:/$
    
  • Warren Hill
    Warren Hill almost 11 years
    While this command will work assuming namu is an administrator. You are in the root directory are you sure you want to put a file here. Users files normally only go in the users home directory.
  • Meintjes
    Meintjes almost 11 years
    Yeah I know... and no I never create files and directories in a root directory ;)
  • Alaa Ali
    Alaa Ali almost 11 years
    Why do you have to log in as root if you want to create directories in /? On the contrary, you should use sudo for better security. What Warren was trying to say is that one usually shouldn't put files in / in the first place. Also, the command to log in as root is just su, not su -root, and that will actually ask you for the root password, which is not set by default in (newer) Ubuntu distros.
  • user175925
    user175925 almost 11 years
    i used this sudo mkdir but getting error as.. namu@ubuntu:/$ sudo mkdir file [sudo] password for namu: namu is not in the sudoers file. This incident will be reported. namu@ubuntu:/$
  • Meintjes
    Meintjes almost 11 years
    yeah i get that and I also stated in my Answer that he should use sudo mkdir file... well you can argue about security but logging in as root and using sudo is basically the same thing... In both cases a normal User can't change stuff if you created it with sudo or you logged in as root and then created the file or directory.
  • user175925
    user175925 almost 11 years
    tried to create directory at home folder but still getting error... gest@ubuntu:~$ su namu Password: namu@ubuntu:/home/gest$ mkdir aa mkdir: cannot create directory ‘aa’: Permission denied namu@ubuntu:/home/gest$ sudo mkdir aa [sudo] password for namu: namu is not in the sudoers file. This incident will be reported.
  • soulsource
    soulsource almost 11 years
    User namu can of course only write to the home folder of namu (usually that's /home/namu). By this, it is ensured that users can't easily delete files of other users. On some systems the permissions are even more strict and users cannot read files of other users per default. If you want to return to the home folder of the current user, you can use cd without any argument.
  • pRAShANT
    pRAShANT almost 11 years
    @user175925: can u post the output what u get after executing sudo -v
  • user175925
    user175925 almost 11 years
    :get ouput as Sorry, user namu may not run sudo on ubuntu.
  • pRAShANT
    pRAShANT almost 11 years
    its bcz u are not assigned super user permissions by your system administrator or u not assigned super user privileges. Thats why it prompts u as u cant use sudo command.