Debian Support

configuring htaccess restrictions on debian apache2 server

Communications | Debian Support | Support

This is a quick guide on how to set up htaccess restrictions on a directory located on a server running apache2 with a debian OS.

First, you will need to update the httpd.conf file, which should be located in the apache2 directory, as follows:

&#60Directory (directory to be protected)&#62
Options Indexes Includes FollowSymLinks Multivews
AllowOverride AuthConfig
Order allow,deny
Allow from all
&#60/Directory&#62

Make sure to take out the "" they are only included so this post displays properly.

Once this update is saved, restart the apache2 server with the following command, or something like it depending on your setup, as follows:

how to use awk to add information to a text file

Communications | Debian Support


awk '{if(/texttofind/) {printf("%s\nfromuser=%s\n",$0,substr($3,index($3,"<")+1,index($3,">")-2))} else print $0}' "file1.txt" > "file2.txt"

where:
if(/texttofind/) does A) if it is true or does B) if not true

texttofind is the text you want to add a new line after

printf("%s\nfromuser=%s\n",$0,substr($3,index($3,"<")+1,index($3,">")-2)

this statement prints the origional line in string format, then drops a new line with the /n. Then prints: fromuser=.. then prints a substring from the above line where the start of the substring is a "<" and the end of the substring is a ">"

byo71's picture

fsck your root partition

Communications | Debian Support

telinit 1
mount -o remount,ro /
fsck -f /dev/hd..
mount -o remount,rw /
runlevel
telinit 3

byo71's picture

mount iso cd image

Communications | Debian Support

mount -o loop -t iso9660 /root/Desktop/etch-custom-1013.iso /mnt/iso

move all mp3 files from 1 partition to a single folder using 1 command.

Communications | Debian Support

To make a list of all the files in a certain place...

locate *.mp3 | grep video > file.txt

To do a mass move of all the files

mv $(cat file.txt | perl -pi -e 's/ /\ /g' | cut -d "/" -f 5 | cut -d "/" -f 2 | sort | uniq) /mnt/home/music/

of course this is just and example, you will have to modify the cut commands and locate commands to do exactly what you want.

do not just copy and paste this command into your console it will not work.

byo71's picture

OpenVPN GUI installer fails to install the TAP32 adapter

Communications | Debian Support

Ever try to install the OpenVPN GUI from openvpn.se and have the tapinstall.exe fail?

Windows 2000/XP has a bug that it cannot properly detect new hardware by
*.inf files, if the RunOnce registry key is missing for the following
location:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion

This key is often used by installers to execute post-reboot programs, but
sometimes they accidentally delete this key.

IMPORTANT: This article contains information about modifying the registry.
Make sure that you understand how to backup and restore the registry, in
case a problem occurs. Please read the linked Microsoft Knowledge Base

byo71's picture

grep an IP for use in a script

Communications | Debian Support

nslookup any.domain.tld | grep Address | cut -d ":" -f 2 | grep -v "#" | cut -d " " -f 2

byo71's picture

passwordless SSH login

Communications | Debian Support

need to run scripts on another server but dont want to have to include your passwords in the scripts?
Use RSA logins instead.
This uses a pre-generated set of public RSA keys to authenticate sessions rather than having to enter passwords.

On the machine you wish to log in from:

$ ssh-keygen -t rsa

make sure to leave the passphrase blank!

$ ssh-copy-id -i ~/.ssh/id_rsa.pub username@server

you will be prompted for the user's password to authenticate the key transfer.

This message will appear when the transfer is complete:

"
Now try logging into the machine, with "ssh 'username@server'", and check in:

byo71's picture

Reset the root mysql password

Communications | Debian Support

Here is how you can reset forgotten root password,
Be aware that following will reset your root password:
# /etc/init.d/mysql stop
# /usr/bin/mysqld_safe --skip-grant-tables --skip-networking &
# mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password=PASSWORD("your password here") WHERE User="root";
mysql> exit

# /etc/init.d/mysql stop
# /etc/init.d/mysql start

Pay attention that, mysql can be in different folders depending on the installation, for different linux version the way you can start or stop the mysql can very.

byo71's picture

mount usb flash drive

Communications | Debian Support

mount -t vfat -o rw,nosuid,nodev,quiet,shortname=mixed,uid=1001,gid=100,umask=077,iocharset=utf8 /dev/sda1 /mnt/usb

XML feed