Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hnelis

macrumors newbie
Original poster
Aug 25, 2015
5
0
I have been trying to change the ownership of a (test) file in two ways . 1) Through finder (get info - sharing and permissions - unlock preferences - clicking + to add a new owner (which had previously been created in the system preferences-accounts) selecting the new owner, clicking the gear icon and choosing "make (username of new owner) the owner. 2) Using terminal : terminal command chown [username] [file ]. In the latter case I get the error "no such file or directory" (although I certainly typed the correct (test) file name. Using the first procedure, attempts to change the ownership have also failed because to unlock the (test) file I still need to type the administrator password and not the password of the new owner.

Has anyone useful ideas on what went wrong in both cases ? I use an Intel iMac running Mac OS 10.6.8.

Thanks.
 
First case you always need to use the password of the previous owner or admin to change to new one. Second with both terminal and finder open start the process with something like chown username:admin in the terminal then drag and drop the file from finder to terminal you will now have the correct path to the file filled in automatically. Check your other files for the second part of the chown username:admin [file] it may be :staff or similar you need to use for it.

Edit: it should be sudo chown .... starting the command in terminal to change from one user to another as well.
 
First case you always need to use the password of the previous owner or admin to change to new one. Second with both terminal and finder open start the process with something like chown username:admin in the terminal then drag and drop the file from finder to terminal you will now have the correct path to the file filled in automatically. Check your other files for the second part of the chown username:admin [file] it may be :staff or similar you need to use for it.

Edit: it should be sudo chown .... starting the command in terminal to change from one user to another as well.
I followed your advice, opening the terminal window and typing chown [username] [file] . I obtained the same error : "no such file or directory". So I am stuck already from the first beginning.
 
I followed your advice, opening the terminal window and typing chown [username] [file] . I obtained the same error : "no such file or directory". So I am stuck already from the first beginning.

Not possible if you dragged and dropped that file from Finder to the Terminal OSX will fill in the file name with its path to it correctly, copy and paste the output from terminal to here so we can see what is going on.

Edit: Include the line with the command too.
 
Not possible if you dragged and dropped that file from Finder to the Terminal OSX will fill in the file name with its path to it correctly, copy and paste the output from terminal to here so we can see what is going on.

Edit: Include the line with the command too.
I dragged and dropped the file (being a folder) from Finder to the terminal window and got the following message :
Users/[username] /Desktop/[file]: is a directory; So I assume the folder had been correctly detected.
I then typed chown [new owner's username] [file] and obtained again the "no such file or directory" error.
 
I dragged and dropped the file (being a folder) from Finder to the terminal window and got the following message :
Users/[username] /Desktop/[file]: is a directory; So I assume the folder had been correctly detected.
I then typed chown [new owner's username] [file] and obtained again the "no such file or directory" error.

Well the chown -R is for a directory this changes the ownership of the directory and every file/directory beneath it.

Edit: Paraphrasing a command like you do here is usually useless when trying to get help. We need to see the actual command most times to be able to help the directory part you give here was the only thing that did do it.
 
Well the chown -R is for a directory this changes the ownership of the directory and every file/directory beneath it.

Edit: Paraphrasing a command like you do here is usually useless when trying to get help. We need to see the actual command most times to be able to help the directory part you give here was the only thing that did do it.
 

OK, here we go. The name of the folder (on the desktop) of which I try to change the owner is test 2. The username of the new owner is Test (with capital).

1. I drag the file, named "test2" in the terminal window and get :
~ hjnelis$ /Users/hjnelis/Desktop/test2
I press enter and get :
-bash: /Users/hjnelis/Desktop/test2: is a directory
I then type : chown Test test2
I get :
chown: test2: No such file or directory

I tried : chown -R Test test2
I get :
chown: test2: No such file or directory

I also tried :
sudo chown Test test2
I filled in the admin password, pressed enter and again obtained the no such file or directory error message.
 
OK, here we go. The name of the folder (on the desktop) of which I try to change the owner is test 2. The username of the new owner is Test (with capital).

1. I drag the file, named "test2" in the terminal window and get :
~ hjnelis$ /Users/hjnelis/Desktop/test2
I press enter and get :
-bash: /Users/hjnelis/Desktop/test2: is a directory
I then type : chown Test test2
I get :
chown: test2: No such file or directory

I tried : chown -R Test test2
I get :
chown: test2: No such file or directory

I also tried :
sudo chown Test test2
I filled in the admin password, pressed enter and again obtained the no such file or directory error message.

$20 says that when you typed "chown Test test2", you were in /Users/hjnelis and not in /Users/hjnelis/Desktop. Change dir into /Users/hjnelis/Desktop and run change ownership again.

Use pwd to know what your current dir is at any given moment in time.
 
This
Code:
~ hjnelis$ /Users/hjnelis/Desktop/test2
is telling you the file test is located in the folder Desktop.

I can tell by the part of the prompt before the $ that you're in your home directory, which is /Users/hjnelis.

From that location, the correct name of the desired file is Desktop/test2, not plain unadorned test2.
 
OK, here we go. The name of the folder (on the desktop) of which I try to change the owner is test 2. The username of the new owner is Test (with capital).

1. I drag the file, named "test2" in the terminal window and get :
~ hjnelis$ /Users/hjnelis/Desktop/test2
I press enter and get :
-bash: /Users/hjnelis/Desktop/test2: is a directory
I then type : chown Test test2
I get :
chown: test2: No such file or directory

I tried : chown -R Test test2
I get :
chown: test2: No such file or directory

I also tried :
sudo chown Test test2
I filled in the admin password, pressed enter and again obtained the no such file or directory error message.

As the others have pointed out you are still not in the proper directory when doing the command it is chown username:group typed in terminal then a drag and drop from finder to get correct path to file to be changed hit enter and it will do it. Now note the :group part on the end of the username you want. I have never seen or used a chown command in my just about couple of decades now of using a *nix system not have the group on the end when changing the owner of a file. And more than likely going to need sudo at the front of the command to be root when changing the file ownership anyways.

Edit: As well hopefully the user named Test is actually a user on the system too.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.