Recurse through directories and delete files with a specific text inside the name
find . | grep FILENAMETOSEARCHFOR | xargs rm -r
Recurse through dirs, find files with a certain textstring in the filename and delete them
find . | grep TEXTSTRINGINFILENAME | xargs rm -r
Find all files that has a certain textstring inside the file
find . | xargs grep TEXTSTRINGINSIDEFILE
Recurse though directories and delete all empty directories
find -depth -type d -empty -exec rmdir {} \;
Recurse through directories and force removal of duplicate files
yes 1 | fdupes -rd .
Recurse and list subdirectories (pipe the command to wc -l if you want to count the number of subdirectories)
find directoryname -mindepth 2 -type d
Remember to backup before you execute commands that recurse and delete!
tirsdag den 28. oktober 2008
mandag den 27. oktober 2008
sshd_config for ssh without password (using a public key)
It seemed so easy to get ssh working without providing a password (using a public key)...
On you client just execute (password left empty):
/etc/ssh/sshd_config:
# Package generated configuration file
# See the sshd(8) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication yes
# similar for protocol version 2
HostbasedAuthentication yes
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords yes
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM no
AllowTcpForwarding yes
AuthorizedKeysFile /usr/NX/home/nx/.ssh/authorized_keys2
This is the content of ~/.ssh directory on the client:
-rw------- 1 username staff 668 26 Okt 22:08 id_dsa
-rw-r--r-- 1 username staff 635 26 Okt 22:08 id_dsa.pub
-rw------- 1 username staff 786 22 Aug 19:27 known_hosts
This is the permisions of ~/.ssh directory on the server:
drwx------ 5 username staff 170 26 Okt 22:08 .ssh
This is the content of ~/.ssh directory on the server:
-rw------- 1 username username 635 Oct 26 22:09 authorized_keys
-rw------- 1 username username 635 Oct 26 22:09 authorized_keys2
-rw------- 1 username username 635 Oct 26 22:09 id_dsa.pub
-rw------- 1 username username 1326 Oct 26 02:05 known_hosts
This is the permisions of ~/.ssh directory on the server:
drwx------ 2 username username 4096 Oct 26 22:09 .ssh
This is the permisions of the user directory (~) on the server:
drwxr-x--- 4 username username 4096 Nov 2 18:40 username
If this does not work you can change the log level in /etc/ssh/sshd_config:
LogLevel DEBUG3
Restart sshd:
sudo /etc/init.d/ssh restart
And watch the log while you try and log in:
tail -f /var/log/auth.log
By the way. I'm runing Ubuntu 8.04 on the server and OSX Leopard on the client. See also http://www.securityfocus.com/infocus/1810
On you client just execute (password left empty):
ssh-keygen -t dsaCopy the created id_dsa.pub file to the server:
scp ~/.ssh/id_dsa.pub myuser@222.222.222.222:~/.ssh/authorized_keysThen ssh to the server without using your normal password. Well for me that just did not work! The last three days I have been googling arround for help on the problem and at last I found the solution. It seems like the problem is common but the reasons varies. One of the major errors are permissions on directories. My problem was not related to permissions but to the sshd_config file on the server. As I couldn't find anyone posting a working configuration file here it goes:
scp ~/.ssh/id_dsa.pub myuser@222.222.222.222:~/.ssh/authorized_keys2
scp ~/.ssh/id_dsa.pub myuser@222.222.222.222:~/.ssh/id_dsa.pub
/etc/ssh/sshd_config:
# Package generated configuration file
# See the sshd(8) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication yes
# similar for protocol version 2
HostbasedAuthentication yes
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords yes
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM no
AllowTcpForwarding yes
AuthorizedKeysFile /usr/NX/home/nx/.ssh/authorized_keys2
This is the content of ~/.ssh directory on the client:
-rw------- 1 username staff 668 26 Okt 22:08 id_dsa
-rw-r--r-- 1 username staff 635 26 Okt 22:08 id_dsa.pub
-rw------- 1 username staff 786 22 Aug 19:27 known_hosts
This is the permisions of ~/.ssh directory on the server:
drwx------ 5 username staff 170 26 Okt 22:08 .ssh
This is the content of ~/.ssh directory on the server:
-rw------- 1 username username 635 Oct 26 22:09 authorized_keys
-rw------- 1 username username 635 Oct 26 22:09 authorized_keys2
-rw------- 1 username username 635 Oct 26 22:09 id_dsa.pub
-rw------- 1 username username 1326 Oct 26 02:05 known_hosts
This is the permisions of ~/.ssh directory on the server:
drwx------ 2 username username 4096 Oct 26 22:09 .ssh
This is the permisions of the user directory (~) on the server:
drwxr-x--- 4 username username 4096 Nov 2 18:40 username
If this does not work you can change the log level in /etc/ssh/sshd_config:
LogLevel DEBUG3
Restart sshd:
sudo /etc/init.d/ssh restart
And watch the log while you try and log in:
tail -f /var/log/auth.log
By the way. I'm runing Ubuntu 8.04 on the server and OSX Leopard on the client. See also http://www.securityfocus.com/infocus/1810
lørdag den 4. oktober 2008
Windows Vista Home Premium OEM 64 bit on Macbook Pro with VMware Fusion 2.0
I just installed Windows Vista Premium OEM 64 bit through Boot Camp and everything just worked without problems. Well until I tried starting the Boot Camp partition from VMware Fusion 2.0 (116369) and it started complaining about a missing ethernet controller driver and a missing basic system driver.
After installing VMware tools and restarting the virtual image it found new hardware and installed the matching VMware drivers. Only problem was that the ethernet driver wasn't found. I then tried installing it manually but without luck and I finally had to contact VMware support. To my surprise the OEM version of Vista isn't supported in Fusion 2.0 and therefore they could not guarantee that it would work...
Well after some communication back and forth they gave me a very simple solution that solved the problem:
VMware Fusion Team does not recommend using OEM install as Guest OS in VMware Fusion. Please go through the following KB article for the same. This is applicable for all VMware Products.
http://kb.vmware.com/kb/1116
Typically, OEM install CDs are designed to place an operating system onto a PC with the factory configuration and defaults specific to that vendor.
I would still like to outreach and help you out, but we would like to remind you that the following suggestions may or may not help you out, even if the suggested solutions works, it might fail under several unpredictable conditions.
If the recommended solution fails then, I would recommend you to install Guest OS using retail/Volume version of Windows OS in Fusion. However it may be possible to install OEM license version of Windows OS, which may or may not lead to unexpected behavior on your system.
I am suggesting you to change "Ethernet Controller" and then install Ethernet driver by going through the below instructions.
1. Power off Virtual Machine
2. Quit VMware Fusion Application
3. Navigate to Virtual Machine folder
Default path for Virtual Machine: Macintosh HD/Users/User Name/Documents/Virtual Machines/Virtual Machine
4. Select Virtual Machine and right click on Virtual Machine
5. Click on "Show Package Contents"
6. Select and open ".vmx" file using a standard text editor
7. Add following parameter to the configuration file
ethernet0.virtualDev = "e1000"
8. Save the modified Configuration file
9. Power on Virtual Machine and check
After adding above parameter in the .vmx file, please download the driver for Intel "e1000" network adapter for Windows Vista from below URL and install the same.
http://support.intel.com/support/network/sb/cs-006120.htm
Thank you for your continued interest with VMware Fusion. We appreciate your valuable inputs shared with us so far.
As my Vista isn't a real VMware image but a Boot Camp partition, the path for the virtual machine was a little different:
/Users/username/Library/Application Support/VMware Fusion/Virtual Machines/Boot Camp/%2Fdev%2Fdisk0/Boot Camp partition.vmwarevm/Boot Camp partition.vmx
After adding the "e1000-line" the network worked after starting the image and I did not need to install the Intel driver described in the last step.
I must say that I am very satisfied with the highly professional and comitted support from the VMware supporter that handled my issue!
After installing VMware tools and restarting the virtual image it found new hardware and installed the matching VMware drivers. Only problem was that the ethernet driver wasn't found. I then tried installing it manually but without luck and I finally had to contact VMware support. To my surprise the OEM version of Vista isn't supported in Fusion 2.0 and therefore they could not guarantee that it would work...
Well after some communication back and forth they gave me a very simple solution that solved the problem:
VMware Fusion Team does not recommend using OEM install as Guest OS in VMware Fusion. Please go through the following KB article for the same. This is applicable for all VMware Products.
http://kb.vmware.com/kb/1116
Typically, OEM install CDs are designed to place an operating system onto a PC with the factory configuration and defaults specific to that vendor.
I would still like to outreach and help you out, but we would like to remind you that the following suggestions may or may not help you out, even if the suggested solutions works, it might fail under several unpredictable conditions.
If the recommended solution fails then, I would recommend you to install Guest OS using retail/Volume version of Windows OS in Fusion. However it may be possible to install OEM license version of Windows OS, which may or may not lead to unexpected behavior on your system.
I am suggesting you to change "Ethernet Controller" and then install Ethernet driver by going through the below instructions.
1. Power off Virtual Machine
2. Quit VMware Fusion Application
3. Navigate to Virtual Machine folder
Default path for Virtual Machine: Macintosh HD/Users/User Name/Documents/Virtual Machines/Virtual Machine
4. Select Virtual Machine and right click on Virtual Machine
5. Click on "Show Package Contents"
6. Select and open ".vmx" file using a standard text editor
7. Add following parameter to the configuration file
ethernet0.virtualDev = "e1000"
8. Save the modified Configuration file
9. Power on Virtual Machine and check
After adding above parameter in the .vmx file, please download the driver for Intel "e1000" network adapter for Windows Vista from below URL and install the same.
http://support.intel.com/support/network/sb/cs-006120.htm
Thank you for your continued interest with VMware Fusion. We appreciate your valuable inputs shared with us so far.
As my Vista isn't a real VMware image but a Boot Camp partition, the path for the virtual machine was a little different:
/Users/username
After adding the "e1000-line" the network worked after starting the image and I did not need to install the Intel driver described in the last step.
I must say that I am very satisfied with the highly professional and comitted support from the VMware supporter that handled my issue!
Automatic synchronization of Sony Ericsson K750 with Macbook
This has been on my todo list for some time now.. I got my Macbook a couple of months ago and without any problems I synced iCal and the contacts with my K750 through iSync. Only problem is that iSync doesn't allow you to setup automatic synchronization in a certain time interval or when the phone is linked through Bluetooth.
With the help from the very useful scripts and instructions from Ali Rantakari I managed to get it running. Well the guideline use launchd to allow syncing between intervals but I wanted automatic syncing when the phone is connected through Bluetooth. So here are the steps to get it working:
Optionally you can download the files from here
With the help from the very useful scripts and instructions from Ali Rantakari I managed to get it running. Well the guideline use launchd to allow syncing between intervals but I wanted automatic syncing when the phone is connected through Bluetooth. So here are the steps to get it working:
- Download the forceSync script package from http://hasseg.org/blog/?p=136 and unzip them in /Users/
username/scripts/forceSyncScript - Make forceSync.bash executable by running "chmod +x forceSync.bash"
- Download and install Growl from http://growl.info
- The Growl package you download has an application called "growlnotify" in the Extras directory. Copy this application to /usr/bin/
- Make growlnotify executable by running "chmod +x growlnotify" in terminal
- Download bluelist from http://will.harris.ch/bluelist.gz place it in /usr/bin/
- Make bluelist executable by running "chmod +x bluelist" in terminal
- Edit the settings section in forceSync.bash so the paths and phone names are set correct
- Test the script setting by executing ./forceSync.bash -v
- Create a new Applescript in "Script editor" that executes the forceSync.bash script (save it in /Users/
username/scripts/forceSyncScript/my Sync.scpt):
do shell script "/Users/username/scripts/forceSyncScript/forceSync.bash"
tell application "iSync" to quit - Download and install Proximity from http://reduxcomputing.com/proximity.php
- Start Proximity and change the settings in Proximity preferences (its the "X" in the osx menu line). In the "Scripts" section point the "In range script" to the sync.scpt script
- Turn on Bluetooth on the phone and you should see the iSync starting to sync the devices
Optionally you can download the files from here
Abonner på:
Opslag (Atom)