Hoofdpagina: verschil tussen versies
(→Linux: SFTP umask added) |
|||
Regel 46: | Regel 46: | ||
May 11 11:20:23 localhost automount[18777]: >> /dev/disk/by-id/usb-WD_My_Book_575532553130303331333730-part1 has been mounted 35 times without being checked, check forced. | May 11 11:20:23 localhost automount[18777]: >> /dev/disk/by-id/usb-WD_My_Book_575532553130303331333730-part1 has been mounted 35 times without being checked, check forced. | ||
</pre> | </pre> | ||
+ | |||
+ | == SFTP umask == | ||
+ | |||
+ | In /etc/ssh/sshd_config kun je de regel aanpassen: | ||
+ | |||
+ | <pre> | ||
+ | Subsystem sftp /usr/lib/openssh/sftp-server -u 002 | ||
+ | </pre> | ||
+ | |||
+ | [http://serverfault.com/questions/70876/how-to-put-desired-umask-with-sftp http://serverfault.com/questions/70876/how-to-put-desired-umask-with-sftp] | ||
== SFTP chroot == | == SFTP chroot == |
Versie van 5 jul 2011 om 08:50
Rolandow's wiki
Vergaarbak van allerlei informatie die ik in de loop der tijd heb verzameld, en niet mag vergeten.
Inhoud
PHP
- PHP Trics: preg_split, SimpleXML attributes, CDATA with dom document
- PHP Extensions: OCI8
- SOAP: WSDL, object mapping
- PHP Downgrade: script om php te downgraden van 5.3 naar 5.2 op Ubuntu
Oracle
- Auto increment: http://jen.fluxcapacitor.net/geek/autoincr.html
Trigger om sequence toe te voegen aan tabel (voorbeeldje)
create trigger MAG_CUST_ID_BR
before insert on MAGENTO_CUSTOMERS
for each row
begin
select MAG_CUST_ID.nextval into :new.CUST_ID from SYS.dual;
end;
Linux
- rsync: exclude examples
Passive FTP
Als passive FTP niet werkt, dan moeten er modules geactiveerd worden. In /etc/modules toevoegen ip_conntrack_ftp en ip_nat_ftp.
Disable periodical fsck check's
The backup disk on jukebox was forcing a periocal fsck. This can be turned off with tune2fs.
tune2fs -c 0 -i 0d /dev/disk/by-id/usb-WD_My_Book_575532553130303331333730-part1
This should stop this message from syslog:
May 11 11:20:23 localhost automount[18777]: >> /dev/disk/by-id/usb-WD_My_Book_575532553130303331333730-part1 has been mounted 35 times without being checked, check forced.
SFTP umask
In /etc/ssh/sshd_config kun je de regel aanpassen:
Subsystem sftp /usr/lib/openssh/sftp-server -u 002
http://serverfault.com/questions/70876/how-to-put-desired-umask-with-sftp
SFTP chroot
We needed a user account to be able to receive files through SFTP. Since our port is opened at 2222 for the outside world. It seems that there is a CHROOT option in OpenSSH server nowadays. This needs to be changed in /etc/ssh/sshd_config:
Subsystem sftp internal-sftp
Match group sftponly
ChrootDirectory /home/%u
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
Then create a user like this:
adduser --ingroup sftponly --shell /bin/false <username>
Software RAID
Howto used to create the software raid array.
Other link with some usefull tips:
http://unthought.net/Software-RAID.HOWTO/Software-RAID.HOWTO.html
Linux trics
Create snoop file of a port:
tcpdump -nvv -s 0 -w snoopport10295.snoop port 10295
Check the number of hits per IP, in the Apache access logs:
cat logs/access_log|grep 05/Feb/2007:14|awk '{print $1}'|sort|uniq -c
See what a process is doing:
lsof -p #PID
Last file in a directory:
ls -ltr|tail -n1
Partially extract a tarbal:
tar xvfz backup.tar.gz home/www/login.mobilebridges.com --exclude=*.log --exclude=*.xml
Use the t parameter instead of x to test tar.
tar tvfz backup.tar.gz home/www/login.mobilebridges.com --exclude=*.log --exclude=*.xml
Format your server:
dd if=/dev/zero of=/dev/hda bs=1M
This writes zero's to /dev/hda, so it will erase all data.
Format disk, using fat32:
1. Use fdisk to create the filesystem: fdisk /dev/hda - follow the prompts 2. Format it using mkfs.vfat -F 32 /dev/hda6 3. Add it to fstab
Add user:
adduser --gid 1010 --shell /usr/bin/false --home /home/www/peru charly
The GID should be the same for dutch and peru users. The home directory is different though.
Delete files older than 5 days:
find /home/www/login.mobilebridges.com/htdocs/Delivery/Error/ -mtime +5 -exec rm {} \;
Rename *.11.csv to *.csv:
rename 's/\.11\.csv$/\.csv/' *.csv
The ereg takes care of the rename action... the *.csv after that just selects the files that need to be renamed with this ereg.
Check projectsize Peru on developement:
/home/www/peru# du --max-depth=1 -h
Check if PING's are reaching the server:
tcpdump host 85.146.37.248 and icmp
85.146.37.248 is the source address.
See the number of connections to port 80 by ip:
netstat -pan|grep :80|sed 's/:/ /g'|awk '{print $6}'|sort|uniq -c
Rsync on an other port:
rsync -av --rsh='ssh -p2222' source destination
SVN
Install SVN server on Debian (also describes creation of repository) http://www.howtoforge.com/debian_subversion_websvn
When you get the error message "OPTIONS of 'http://172.16.255.14/cms': 200 OK (http://172.16.255.14)" this means that the path to the repository is incorrect. Check the /etc/apache2/mods-enabled/dav_svn.conf. Is the new repository added? Right path in the Location tag? Right path after SVNPath?
Als je de 64 bits client hebt geinstalleerd, moet je de 32 bits client ook doen, anders werkt de integratie met PhpEd niet. Zie http://www.nusphere.com/kb/technicalfaq/tip_phped_and_svn.htm
Mail attachment command-line
Met mutt kun je een attachment eenvoudig mailen, rechtstreeks van de command-line in de linux shell.
echo "Check deze logfile" | mutt -a /var/log/message rolandow@gmail.com
sar / sysstat / rs-sysmon monitor
Door package sysstat te installeren, kun je met sar gegevens terughalen over memory en cpu gebruik. Met rs-sysmon worden er dumps gemaakt in /var/log/rs-sysmon.
- http://www.howtoforge.com/system-monitoring-with-sar-and-ksar
- http://sebastien.godard.pagesperso-orange.fr
rs-sysmon is een script dat rackspace heeft ontwikkeld, en staat in /usr/sbin/rs-sysmon. Dit draait om de zoveel tijd en schrijft dingen weg in logfiles, zodat je achteraf logfiles kunt kijken van het systeem. Script zou gejat moeten worden van RS :-)
Software
Wintendo
- mp42avi: Converteren van mp4's en mov's naar avi
- eRightSoft SUPER: Converteren van allerlei formaten, GUI voor encoders
- iConvert: Encode to flv
Linux
- csync2: Automagisch syncen van bestanden
- ucarp: VRRP failover gedoe
- ncftp: client die bij Dreamhost geinstalleerd staat .. handig voor het overzetten van websites via ftp, want hij kan recursief mappen copyeren.
MS-DOS
Onder windows 7 kun je ervoor zorgen dat je batch wordt uitgevoerd als Administrator, door er met de rechterknop op te klikken. Zo kun je CMD ook als admin uitvoeren.
Route
Gateway routering aanpassen:
route delete 0.0.0.0
route add 81.175.103.10 mask 255.255.255.255 172.16.0.10
route add 0.0.0.0 mask 0.0.0.0 172.16.255.14
DNS
Met het commando "netsh" kun je ook DNS servers aanpassen.
netsh interface ip set dns "LAN-verbinding" static 8.8.8.8 primary
netsh interface ip add dns name="LAN-verbinding" 208.67.222.222
netsh interface ip add dns name="LAN-verbinding" 208.67.220.220
netsh interface ip add dns name="LAN-verbinding" 172.16.0.131
Meer tips en truucs:
http://www.petri.co.il/configure_tcp_ip_from_cmd.htm
Magento
Locatie default e-mails: /app/locale/nl_NL/template/email
HP
Om de laserjet die aan Ubuntu is gekoppeld aan de praat te krijgen heb ik deze handleiding gevolgd: http://www.sevenforums.com/drivers/20537-installing-sharing-hp-laserjet-1020-win7-x64.html
De CUPS pagina is via poort 631. Op het moment van schrijven: http://192.168.1.51:631/printers/HP-LaserJet-1020
Mozilla Thunderbird
Als je Thunderbird in de vertical view hebt, dan krijg je het scherm opgedeeld in drie kolommen. Nu wilde ik het e-mail bericht zelf in het midden zien. Dus Folder | Message | Message list. Dit blijkt te kunnen door in de profile map een CSS aan te maken. Je moet naar je user in Documents and Settings gaan en dan naar AppData, (Roaming), Thunderbird, Profiles, xxxxx.default .. dan hier een folder chrome aanmaken. Daarin een bestand userChrome.css aanmaken, met hierin de regel:
#threadPaneBox{-moz-box-direction: reverse;}
Bron: http://forums.mozillazine.org/viewtopic.php?f=19&t=623255
Redmine
Als het mailen niet werkt, kan dit komen door een exim config fout. De melding in de mainlog is dan:
2010-10-18 11:22:45 rejected EHLO from localhost [127.0.0.1]: syntactically invalid argument(s): (no argument given)
Dit is op te lossen door redmine op sendmail configuratie te draaien. Dit doe je door in redmine/config/email.yml te zetten:
production: delivery_method: :sendmail # delivery_method: :smtp # smtp_settings: # address: "localhost" # port: 25
Het gecommente deel is wat er stond.
Exchange
Signature
Je kunt eenvoudig bij de locatie van je signature files komen. In Exchange ga je naar de opties, en dan naar tabje E-mailindeling. Houd nu CTRL ingedrukt als je op Handtekeningen drukt, en je komt in de filebrowser naar de bestanden.
Bron: http://blogs.msdn.com/b/outlook/archive/2008/07/11/how-do-i-back-up-my-signatures.aspx
RegExp (textpad)
Mobile Bridges standards naar Zend standards
Voor het vervangen van de standaard van MB naar de standaard van Zend, kunnen de volgende search and replaces uitgevoerd worden in Textpad.
Voor het vervangen van $this->mPage naar $this->_page kun je in textpad de volgende parameters opgeven. De _ moet alleen voor private en protected vars, maar we gebruiken als het goed is geen public's.
- Search: $this->m\([A-Z]\)
- Replace: $this->_\L\1
De \L zorgt ervoor dat het lowercase wordt, en de \1 is het eerste gevonden groepje. Want \0 zou de hele zin zijn.
Voor het vervangen van $lPage en $aPage naar $page:
- Search: $[al]\([A-Z]\)
- Replace: $\L\1
Voor het vervangen van $mPage naar $_page:
- Search: $m\([A-Z]\)
- Replace: $_\L\1
Voor het vervangen van de functions die met een hoofdletter beginnen:
- Search: function \([A-Z]\)
- Replace: \L\0
Voor de aanroep van functies binnen de class, $this->SetBlablaFoo(...) naar $this->setBlablaFoo(...):
- Search: $this->\([A-Z]\)\([A-Za-z]*\)(
- Replace: $this->\L\1\E\2(
Dreamhost
Backup
Automagisch backuppen naar de backup user en snapshots maken.
http://blog.wangling.me/2009/07/meta-backup-dreamhost-on-dreamhost-backups
Encoding
Iets gelezen over het converteren van bestandsnamen. Handig voor als er een samba share is die verkeerde encoding heeft?
Commando convmv.
Bron: http://en.wikipedia.org/wiki/Character_encoding#Character_encoding_translation
Magento
Magento: Magento aanpassingen. Compare products verwijderen.