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,298 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 

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
 
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

717 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