• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1355
  • Last Modified:

Is ther a way to unlock all files and folders in a directory at once in Ubuntu?

I'm running Ubuntu 9.04 with VMware Server 2.0.  I want to copy all my Virtual Machines over to a newly built computer,  with the same setup, but most of them are locked and won't allow me to copy them.  Is there a way, perhaps a script, to unlock them all at once instead of going into every VM and unlocking every file individually?  There are 18 VMs and that's pretty labor intensive.  Thanks
0
thadley
Asked:
thadley
1 Solution
 
pturingCommented:
File locking in Linux is normally informative rather than enforcing; no matter what vmware does you should still be able to copy the files. You may be having another type of issue, such as a permissions problem, so check the ownership and permissions on the file.

However, it is a good idea to suspend your virtual machines before making a copy. You can use a script such as this one to suspend all the running virtual machines:
http://communities.vmware.com/thread/76635
0
 
thadleyAuthor Commented:
Yes, I guess you're right, it's more of a permissions issue.  I have to go in an change the ownership of the files with sudo chmod 755 <file> , then I can copy the VM directory with all of its files to another machine.  VMware uses the root account but is not running when I copy the VM.  

  I was looking for a way to automate changing permissions on them.  Once I change all the permissions on the files, I can do an FTP session from one server to another and Copy and Paste all the virtual machines over.

Is there a script for that?  The script in the link above is mainly for a backup and looks like it compresses the files.  I just want to copy them over to another PC.  Thanks.
0
 
Sikhumbuzo NtsadaCommented:
On the new  PC, run the following command:

scp -r usename@old_pc_with_vm:/home/username/filename

Subtitute username with your real one and hostname/IP address and the path where
the VMs reside.

You need to have the same username as the one on the old PC
 to make things work easy. Even if you do not have it will work but it needs other tricks. then supply the password of the logged in username.


Or inside the old PC run the following:


scp -r /path/filename/ username@new_PC:/path/final_folder
You also need the password of the other PC at destination.

It works easy if you have identical usernames.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
thadleyAuthor Commented:
@Santasi24  Using the second command line I was able to transfer a file from the new computer, running Ubuntu 10.10 to the old computer, running Ubuntu 9.04.  But when I do it the other way around, 9.04 to 10.10, it says permission denied.  I'm not sure what I did on 10.10 or maybe it just has more security.

 I couldn't get the first command to work at all, in either direction.  I have identical usernames on both machines.
0
 
Sikhumbuzo NtsadaCommented:
Have you tried to share the whole folder that contains the VMs, make sure that you allow guest to make changes  and then on the new PC, select Places, connect to Server - on the dialogue that appears just put the IP address of the OLD PC without user name first and try user name if it won't work still.
Remember to select the SSH/Linux server option.


Also post me the ls -a result inside the folder that has the VMs.

0
 
thadleyAuthor Commented:
OK, I got all the files moved over, here is what I did.  I had to load the sshserver and client on the new machine (sudo apt-get sshserver sshclient) I changed owner of the VMWare folder (sudo chown me vmware), one folder higher than the Virtual Machines folder.  Then, I was able to connect from the old to the new computer via Connect to Server, SSH, IP address, port 22, folder path /var/lib/vmware (I didn't connect right to Virtual Machines, the space presented a problem).  

Then, I was just able to copy and paste the virtual machine folders over to the new computer.

As for my original question about a script for changing permissions (unlock) on the files, using sudo chmod 755 <file>, I used a note pad and copy and pasted the commands, which was still somewhat labor intense to set it up but not as much as going into all the virtual machines separately.

Thanks for all the responses and help.

0
 
TobiasHolmCommented:
If you show me the commands you run I can help you make a script. You should be able to put the commands in a text file, insert a line first in the text file:

#!/bin/bash

And the replace some keywords with variables. I.e. If you're gonna execute a command on several servers you can switch the servername to a variable and make a function in the script. Hard to explain in words, but if you show me the commands you're running and explains on which servers you're running them I can help you to create a script if you'd like.

Regards, Tobias
0
 
thadleyAuthor Commented:
I wanted to see if there was a script of some type to unlock all files in a folder.  I didn't get that answer but through trial and error, figured out a way around it.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now