Solved

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

Posted on 2011-02-18
8
1,198 Views
Last Modified: 2013-11-15
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
Comment
Question by:thadley
8 Comments
 
LVL 1

Expert Comment

by:pturing
ID: 34930101
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
 

Author Comment

by:thadley
ID: 34931777
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
 
LVL 17

Expert Comment

by:Sikhumbuzo Ntsada
ID: 34931852
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
 

Author Comment

by:thadley
ID: 34935656
@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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 17

Expert Comment

by:Sikhumbuzo Ntsada
ID: 34940311
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
 

Accepted Solution

by:
thadley earned 0 total points
ID: 34946386
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
 
LVL 18

Expert Comment

by:TobiasHolm
ID: 35913917
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
 

Author Closing Comment

by:thadley
ID: 35944462
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In order for businesses to be compliant with certain information security laws in some countries, you need to be able to prove that a user (which user it was becomes important to the business to take action against the user after an event has occurr…
Users are often faced with high disk consumption without really knowing where the largest amount of data resides. Disk Usage Analyzer (aka Baobab) is is a graphical, menu-driven application to analyse disk usage in any Gnome environment and can e…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now