1

just moved from shared hosting to a dedicated server, trying to create two new directorys in the root of the server but I get this when I use the Plesk control panel

Error: Unable to create directory /other-files: filemng: Error occurred during /bin/mkdir command.

So I tried executing this

$old_umask = umask(0);
$return = mkdir('../other-files', 0770);
umask($old_umask);
var_dump($return); 

which returns false

I've downloaded putty but I've never used SSH commands and to my understanding I think I need to create the folder as a root user, but I really don't want to do something wrong and I don't think I can log in as the root user, but I can execute a su command which seems to be what I need to do... any help?

Pam
  • 77
  • 9
  • do you know the name of the linux distribution that you use? what's the output of whoami – hovanessyan Jun 01 '12 at 12:00
  • @hovanessyan do you mean type whoami into the command line? Well I did and it just outputted the username I set up for the server, and is this it? - OS: Linux CentOS 64-Bit – Pam Jun 01 '12 at 12:09
  • Ok so if you want to create directory 'foo', just try: su , you will be prompted for pass, and than '/bin/mkdir /foo'. – hovanessyan Jun 01 '12 at 12:12
  • # /bin/mkdir/other-files bash: /bin/mkdir/other-files: Not a directory @hovanessyan - that is the response – Pam Jun 01 '12 at 12:16
  • you are missing a space, the command should be '/bin/mkdir /other-files' assuming you want to create top-level direcoty called 'other-files' – hovanessyan Jun 01 '12 at 12:18
  • 1
    it's not a good idea, you should define working user (different from root) and use the home folder of that user for the everyday work etc. – hovanessyan Jun 01 '12 at 12:20
  • okay it allowed the command but no response, so I've checked my root directory and it doesn't seem to have worked – Pam Jun 01 '12 at 12:21
  • i think i may do it differently @hovanessyan – Pam Jun 01 '12 at 12:22
  • navigate to the directory, where you expect the folder to appear. Paste the output of 'pwd' – hovanessyan Jun 01 '12 at 12:23
  • [root@ip- ecminion]# /bin/mkdir /other-files [root@ip- ecminion]# cd /bin [root@ip- bin]# pwd /bin [root@ip- bin]# cd ~ [root@ip- ~]# pwd /root [root@ip- ~]# [root@ip- ~]# [root@ip- ~]# /bin/mkdir /other-files /bin/mkdir: cannot create directory `/other-files': File exists [root@ip- ~]# @hovanessyan – Pam Jun 01 '12 at 12:26
  • if I run this from the main domain of the server $filename = "../other-files"; if (file_exists($filename)) { echo "The file $filename exists"; } else { echo "The file $filename does not exist"; } it says it doesn't exist – Pam Jun 01 '12 at 12:29
  • In Linux / is called 'the root', if you want to create folder under /root, you have to execute '/bin/mkdir /root/other-files'. /root is the 'home directory' of the root user, and / is the ROOT of them all. – hovanessyan Jun 01 '12 at 12:29
  • 1
    Check out this guide http://www.comptechdoc.org/os/linux/usersguide/linux_ugfilestruct.html and you should really read more before taking VPS to use or (god forbid) administer. – hovanessyan Jun 01 '12 at 12:30
  • thanks! I really should probably delete the folder I just put in root I think I meant home... – Pam Jun 01 '12 at 12:35
  • yeah - you can delete it using rmdir (the directory should be empty). – hovanessyan Jun 01 '12 at 12:40

0 Answers0