• Home
  • Programming
    • API
      • Google
    • Javascript
    • Php
    • Server
  • CMS
    • Magento
    • Yahoo! Store

Useful SSH commands for access issues and Keys

Thursday, 14 January 2016 13:44
Tim Ramsey
0 Comments
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#How to block an IP using iptables?
iptables -A INPUT -s xx.xx.xx.xx -j DROP
 
#How to block an IP for a specific port:
iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j DROP
 
#How to allow access to an IP?
iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT
 
#How to allow access to an IP to a specific port using iptables?
iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j ACCEPT
 
#See if SSHD is running and listen to port
netstat -tlpn
 
mkdir .ssh
chmod 700 .ssh
nano .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
 
#restart ssh ubuntu
/etc/init.d/ssh

Load custom php.ini with CRON job

Friday, 13 February 2015 14:46
Tim Ramsey
0 Comments
Live and learn. I didn’t realize that when a cron job runs, it does not load the site php.ini file, but by adding a custom directive, we can tell the the php cron job to load the file.
1
php -c /home/username/config/php.ini /home/username/script.php
The error I was receiving is below even though I had allow_url_fopen enabled:
Warning: simplexml_load_file(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/username/script.php on line 12
Adding the custom directive resolved the issue and hopefully will for you too.

How to duplicate | copy a Magento Database with SSH

Tuesday, 30 December 2014 22:41
Tim Ramsey
0 Comments
I was a bit hopeful with phpMyAdmin “Synchronize”, but Magento’s databases are apparently too big for it because I ended up with white screens and partial uploads.  I resorted to using SSH and doing it over command line.  Two lines of code and you can export from your live database and import into a production database.  Here you go. Export
1
mysqldump -u username -p database_name > dump.sql
  Import
1
mysql -u username -p target_database_name < dump.sql
Hopefully saved you some time and frustration 🙂

How to change “Date Modified” in Windows with PowerShell

Tuesday, 11 November 2014 20:24
Tim Ramsey
0 Comments
I was doing some development locally and needed to change the file time on some files so I could delete certain files in a directory.  Below is the code I used to change the files modified time:
1
2
3
$a = Get-Item C:\file-in-question.txt
$b = Get-Date "11/10/2014 8:00 AM"
$a.LastWriteTime = $b
Hopefully you find this as useful as I did!

Page 10 of 13

  • Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • Next

Categories

  • CMS
    • Magento
    • Shopify
    • Yahoo! Store
  • Programming
    • API
      • Google
    • Javascript
    • Php
    • Server
    • SVN
  • VOIP

Recent Posts

  • Github permission denied from cPanel
  • Magento 2 Remove version signing static files
  • Composer Memory Limit Issues when updating/installing
  • Installing WHM/Cpanel on Digital Ocean
  • Setup of AWS RTMP Server with EFS