Monday, September 19, 2016

How to access git using a key pair



The following method will help you accessing your repository using a keypair file. 
This could be usefull when you are using Amazon server with a keypair file without a password otherwise you don't need to follow this guide.

1) Upload/Copy the keypair file (.pem) on your  ~/.ssh/ directory

$ cp cert.pem  ~/.ssh/.

2) Move on your ssh directory and change the permissions on the file

$ chmod 400 cert.pem

3) Create or update your  ~/.ssh/config file

$ nano  ~/.ssh/config

4) Copy and update the rows below with the correct hostname, user and identifyfile:

Host git
Hostname www.example.com
User ubuntu
IdentityFile /pathtossh/ssh/cert.pem

5) Clone the repository

$ git clone git:/path/to/remoteproject/repository.git

Done!

If you need to copy and overwrite the entire cloned project inside another directory you could you the command below:

$ \cp -R source destination

To update your projects and use the new address you need to open the project's git config file

$ nano ~/path/to/remoteproject/.git/config 

After that you have to change the url line:

git:path/to/remoteproject/repository.git





Read more...

Sunday, June 26, 2016

Fix TImezone on RDS Mysql MariaDB

In this post i will explain the steps to fix the timezone UTC "issue" on RDS (if we can call it an issue...). If you need to do that you have to follow this guide. I used MariaDB as mysql fully compatible database.

1) Connect to your RDS instance via shell or client

2) Create the following stored procedure 
DELIMITER | CREATE PROCEDURE mysql.store_time_zone () IF NOT (POSITION('rdsadmin@' IN CURRENT_USER()) = 1) THEN SET SESSION time_zone = 'Europe/Rome'; END IF | DELIMITER ; 

3) Grant permission to the user 
GRANT EXECUTE ON PROCEDURE `mysql`.`store_time_zone` TO 'usersql'@'%'; 

4) Create a new parameter group with eg. Timezonefix 

5) In the search bar search for "init_connect" 

6) Insert the following value: CALL mysql.store_time_zone 

7) Go to your rds instance and modify it selecting the new parameters group 

8) Apply immediatly 

9) Reboot your instance and the job is done.


Read more...

Thursday, May 8, 2014

Parallels Plesk Can't Create/Write to file /tmp/#sql_ MYD (Errcode 17)

To fix this error on parallel plesk, you need to remove the /tmp/#sql_xxx.MYD file from the tmp directory in your root.


Read more...

Saturday, April 5, 2014

SSH exchange identification: Connection closed by remote host [Solved]

If you will face this problem when connecting through ssh:
SSH exchange identification: Connection closed by remote host.
Maybe your server was under a brute force attack. To solve this problem in an easy way you could install denyhosts. On Centos server yum install denyhosts. Edit /etc/hosts.allow and insert the IP that you never want to block. Edit /etc/denyhosts.conf and check your distribution default conf. After that, simply start denyhosts service denyshosts start Stay tuned.


Read more...

Friday, June 14, 2013

[Solved] Vsftpd with chrooted users not restart on Ubuntu 12.04

If you face this error on your Ubuntu 12.04 500 OOPS: vsftpd: refusing to run with writable root inside chroot()

Once edited the /etc/passwd to chroot the user with /bin/rbash and after changed permissions on the directory that will be the ftp home directory of the user, to enable vsftpd without errors on starting the service you need to follow the steps below:

1) wget http://http.us.debian.org/debian/pool/main/v/vsftpd/vsftpd_3.0.2-3_amd64.deb

2) dpkg -i vsftpd_3.0.2-2_amd64.deb

3) echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf

4) /etc/init.d/vsftpd restart

Now you will be able to restart your vsftpd service without any other issue.


Read more...