Tag Archives: linux
Have you ever had the problem that you needed to extract all zip-files in a folder and found that ‘unzip *.zip’ doesn’t work?
The solution is to escape the *. You need to use ‘unzip \*.zip’.
Because i google this so often:
To add a complete directory to a tar file and compress the tar use this:
tar cfvz NAME.tar.gz [DIRECTORY]
To extract the files use:
tar xfvz NAME.tar.gz
If you have many files in the directory it might be a good idea to leave the v parameter out.
- mknod created a new device.
- -m660 sets the mode to 660 for the filesystem.
- /dev/loop8 specifies the device to create.
- b sets the device as a block device.
- 7 and 8 are major and minor device numbers.
So this creates on a standard Linux the eighth loopback device.
mknod -m660 /dev/loop8 b 7 8 chown root.disk /dev/loop8 chmod 666 /dev/loop8
- Make sure you have the required modules in the kernel. Use ‘modprobe cryptoloop’ and ‘modprobe aes’.
- Create empty 100MB file image named MyImage.img with ‘dd if=/dev/urandom of=MyImage.img bs=1M count=100’. Be warned, this my take some minutes.
- ‘losetup -e aes /dev/loop0 MyImage.img’ connects your image to loop0.
- You have to enter your new password now.
- With ‘mkfs -t ext2 /dev/loop0’ formats your new ‘drive’.
- ‘mount /dev/loop0’ and
- ‘mount -o loop,encryption=aes MyImage.img /mysafe’ mount your new document safe to /mysafe. You might need to create /mysafe before that.
- Install samba with ‘apt-get install samba’
- Follow the install wizard and enter ‘workgroup’ and if you use a dhcp server
- Add a directory for samba shares. ‘mkdir /samba
- Add a usergroup for samba. ‘groupadd sambauser’
- Give directory to the group. ‘chgrp sambauser /samba’
- Change the rights. ‘chmod 770 /samba’
- Add a user. ‘useradd -g sambauser windowsclient’
- Give the user a password. ‘passwd windowsclient‘
- Add samba password, make it the same as the linux user password. ‘smbpasswd -a windowslcient’
- Enable user in samba. ‘smbpasswd -e windowsclient’
- Add the following to /etc/samba/smb.conf
- path = /samba
- writable = yes
- public = no
- valid users = windowsclient
- force create mode = 0770
- force directory mode = 0770
- Restart samba with /etc/init./samba restart’.
Now you should see your server under network on the windows system and can connect using the account windowsclient / password.
I had this old Cisco NSLU2 around, doing nothing other than bringing an even older USB HDD to the network. And i honestly never really used it, because the truth is, the NSLU2 is slow.
So i found this great site where they explain how to flash Linux on the device some time ago. And now, after having to set up a few Debian server and no reasonable way to hide from it, i decided to put a Debian on the NSLU2.
The instructions are quite simple as the device is supported by Debian 5.0.
Some advice from personal experience:
- Use a singe 2,5” (notebook) USB drive. With 2 drives, powered over USB, you might get problems with the power supply. One works great for me.
- Expect to spend up to 3 hours on this. Without playing, just installing and configuration.
- Do not expect the NSLU2 to perform like a computer or vps. It is slow, but its performance positively surprised me.
- Use the provided unofficial image.
If you are using linux on your computer or operate your own (virtual-)server you will likely be faced with the problem to transfer data from an other computer/server to your own.
wget is a little linux tool that i usually in a standard installation. Here are a few examples for the most common uses. If you need a more in-depth explanation, please consult the man pages.
Getting a single file from remote location:
Specify the number of downloads attempts:
- wget -t 5 http://www.example.com/myfile.zip
Continue a interrupted download:
Login credentials needed? No problem:
- wget –user=USERNAME –password=PASSWORD http://www.example.com/myfile.zip
Download a webpage or something else recursive:
- wget -r -l 2 http://www.example.com
- loads the page recursive to a depth (level) of 2
Want to download all pictures from a list of websites?
- -A jpg,gif,png,bmp,jpeg specifies a acceptlist of file extensions.
- -i filename to specify a file with the websites
- -q suppresses messages to the console
- wget -i mylist.txt -A jpg,gif,png,bmp,jpeg -q -r -l 10