Мой профиль...

Search This Blog

Friday, February 5, 2016

How To Use SSHFS to Mount Remote File Systems Over SSH - Как замаунтить ssh диск

1. Make authorized_keys with remote server

  • for generate key use ssh-keygen
  • for change password use ssh-keygen -p
It's made such files:
~/.ssh/id_rsa.pub - opened key
~/.ssh/id_rsa - private key
After that copy key into remote server: ssh-copy-id user@server

2. Installing SSHFS

sudo apt-get install sshfs

3. Mounting the Remote File System

sudo mkdir /mnt/droplet <--replace code="" droplet="" prefer="" whatever="" you="">
sudo sshfs root@xxx.xxx.xxx.xxx:/ /mnt/drople
sudo sshfs -o IdentityFile=~/.ssh/id_rsa root@xxx.xxx.xxx.xxx:/ /mnt/droplet

4. For permanent connection add following record to /etc/fstab

USERNAME@HOSTNAME_OR_IP:/REMOTE/DIRECTORY  /LOCAL/MOUNTPOINT  fuse.sshfs _netdev,user,idmap=user,transform_symlinks,identityfile=/home/USERNAME/.ssh/id_rsa,allow_other,default_permissions,uid=USER_ID_N,gid=USER_GID_N 0 0

Thursday, February 4, 2016

How to find the mysql data directory from command line

You can issue the following query from the command line:

mysql -uUSER -p -e 'SHOW VARIABLES WHERE Variable_Name LIKE "%dir"'

Output (on Linux):

+---------------------------+----------------------------+
| Variable_name             | Value                      |
+---------------------------+----------------------------+
| basedir                   | /usr                       |
| character_sets_dir        | /usr/share/mysql/charsets/ |
| datadir                   | /var/lib/mysql/            |
| innodb_data_home_dir      |                            |
| innodb_log_group_home_dir | ./                         |
| lc_messages_dir           | /usr/share/mysql/          |
| plugin_dir                | /usr/lib/mysql/plugin/     |
| slave_load_tmpdir         | /tmp                       |
| tmpdir                    | /tmp                       |
+---------------------------+----------------------------+

Or if you want only the data dir use:

mysql -uUSER -p -e 'SHOW VARIABLES WHERE Variable_Name = "datadir"'

 

Tuesday, February 2, 2016

Sublime doesn't keep documents between session

From time to time I've got the same problem, when install new instance of Sublime on a new environment: I had run it as sudo on first time and after that Sublime forgot opened document. It's happened 'couse the config files for Sublime are created with root permissions. For fix it just run:
sudo chown -R <user>:<group> ~/.config/sublime-text-X

Релевантные посты...

Related Posts with Thumbnails