mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-25 16:36:07 +08:00
修复私钥权限
This commit is contained in:
parent
7caabe9063
commit
5bb1afe5c6
|
@ -35,7 +35,10 @@ export default class SshKeyService {
|
||||||
private generateSshConfig(configs: string[]) {
|
private generateSshConfig(configs: string[]) {
|
||||||
try {
|
try {
|
||||||
for (const config of configs) {
|
for (const config of configs) {
|
||||||
fs.appendFileSync(this.sshConfigFilePath, config, { encoding: 'utf8' });
|
fs.appendFileSync(this.sshConfigFilePath, config, {
|
||||||
|
encoding: 'utf8',
|
||||||
|
mode: '400',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error('写入ssh配置文件失败', error);
|
this.logger.error('写入ssh配置文件失败', error);
|
||||||
|
@ -56,6 +59,7 @@ export default class SshKeyService {
|
||||||
public addSSHKey(key: string, alias: string, host: string): void {
|
public addSSHKey(key: string, alias: string, host: string): void {
|
||||||
this.generatePrivateKeyFile(alias, key);
|
this.generatePrivateKeyFile(alias, key);
|
||||||
const config = this.generateSingleSshConfig(alias, host);
|
const config = this.generateSingleSshConfig(alias, host);
|
||||||
|
this.removeSshConfig(config);
|
||||||
this.generateSshConfig([config]);
|
this.generateSshConfig([config]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user