Linux下输入的密码明文现实,linux中mydumper需要输入明文密码解决方案

在使用mydumper时,需要再命令行中输入用户名和密码,这会记录到history中,这样的话,就是相对不安全。

[root@liufofu backup]# mydumper -h localhost -u root -p tiger -c -o ./liufofu/ -B liufofu

查了下官方提供的解决方案有2种:

1、在homedir中新建一个.my.cfg,输入你的用户和密码

2、打上相应的补丁

具体可以参考官方的回复

1. Use ~/.my.cfg with your login and password to authenticate. It will both not save password in bash history and hide password if ps list, but you’ll have to keep plaintext password in your homedir.

2. Try this patch

commit 056fa3edc2a3880d35986d6f123430fde5fe292a

Author: Dmitry Ilyin Date: Sat Oct 27 02:10:40 2012 +0400

Add cmdline mask for mydumper

diff –git a/mydumper.c b/mydumper.c

index 9c37d39..39edff1 100644

— a/mydumper.c

+++ b/mydumper.c

@@ -367,6 +367,15 @@ int main(int argc, char *argv[])

init_mutex = g_mutex_new();

+ //calculate cmdlen

+ int cmdlen = 0;

+ int argn = 0;

+

+ for (argn = 0; argn < argc; ++argn) {

+ cmdlen += (int) strlen(argv[argn]);

+ }

+ cmdlen = cmdlen + argc – 1;

+

context = g_option_context_new(“multi-threaded MySQL dumping”);

GOptionGroup *main_group= g_option_group_new(“main”, “Main Options”, “Main Options”, NULL, NULL);

g_option_group_add_entries(main_group, entries);

@@ -377,6 +386,11 @@ int main(int argc, char *argv[])

exit (EXIT_FAILURE);

}

g_option_context_free(context);

+

+ //erase cmdline

+ memset(argv[0],’\0′,cmdlen);

+ //set new cmdline

+ sprintf(argv[0],”mydumper: dumping database ‘%s’”,db);

if (program_version) {

g_print(“mydumper %s, built against MySQL %s\n”, VERSION, MYSQL_SERVER_VERSION);

——-

and this for my loader

——-

commit f8f9850045a317b927903482317ee32ecce47eea

Author: Dmitry Ilyin Date: Sat Oct 27 02:24:33 2012 +0400

Add cmdline mask for myloader

diff –git a/myloader.c b/myloader.c

index 7697e97..a38b4fd 100644

— a/myloader.c

+++ b/myloader.c

@@ -93,6 +93,15 @@ int main(int argc, char *argv[]) {

init_mutex= g_mutex_new();

+ //calculate cmdlen

+ int cmdlen = 0;

+ int argn = 0;

+

+ for (argn = 0; argn < argc; ++argn) {

+ cmdlen += (int) strlen(argv[argn]);

+ }

+ cmdlen = cmdlen + argc – 1;

+

context= g_option_context_new(“multi-threaded MySQL loader”);

GOptionGroup *main_group= g_option_group_new(“main”, “Main Options”, “Main Options”, NULL, NULL);

g_option_group_add_entries(main_group, entries);

@@ -104,6 +113,11 @@ int main(int argc, char *argv[]) {

}

g_option_context_free(context);

+ //erase cmdline

+ memset(argv[0],’\0′,cmdlen);

+ //set new cmdline

+ sprintf(argv[0],”myloader: loading from directory ‘%s’”,directory);

+

if (program_version) {

g_print(“myloader %s, built against MySQL %s\n”, VERSION, MYSQL_SERVER_VERSION);

exit(EXIT_SUCCESS);

—-

They hide password and other arguments from ps list

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值