Linux配置ssh
不知道为什么,在阿里云控制台上绑定只有提供了一个私钥,公钥应该是会自动部署到服务器上的,但没有,使用这个私钥就一直说无法认证。没办法了,只能是自己丰衣足食了
1 2
| ssh-keygen -t ed25519 -f "$env:USERPROFILE\.ssh\密钥名称" -C "这里可以添加一些注释"
|
提示输入密码时,直接按 Enter(留空)
1 2
| Enter passphrase (empty for no passphrase): [直接按Enter] Enter same passphrase again: [直接按Enter]
|
之后进入服务器
1 2 3 4 5
| # 创建 .ssh 目录(如果不存在) mkdir -p ~/.ssh
# 添加公钥到授权文件 echo "粘贴的公钥内容" >> ~/.ssh/authorized_keys
|
1
| ssh -i C:\Users\user\.ssh\密钥名称 root@公网地址
|
如果还是不行,应该是shhd_config文件没有开放ssh链接
1 2 3 4
| # 进入/etc/ssh/sshd_config
PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keysroot@
|
在Windows中ssh便捷连接方法
- 在Windows中创建config文件
~/.ssh/config1 2 3 4 5
| # Host 名称 HostName IP地址 User Linux用户名 IdentityFile 密钥路径
|
在powershell中运行 ssh 登陆名称 就可以登陆了!
let artalkItem = null
const option = null
const isShuoshuo = GLOBAL_CONFIG_SITE.pageType === 'shuoshuo'
const destroyArtalk = () => {
if (artalkItem) {
artalkItem.destroy()
artalkItem = null
}
}
const artalkChangeMode = theme => artalkItem && artalkItem.setDarkMode(theme === 'dark')
const initArtalk = (el = document, pageKey = location.pathname) => {
artalkItem = Artalk.init({
el: el.querySelector('#artalk-wrap'),
server: 'https://interact.whoisjory.com',
site: 'Jorysinteract',
darkMode: document.documentElement.getAttribute('data-theme') === 'dark',
...option,
pageKey: isShuoshuo ? pageKey : (option && option.pageKey) || pageKey,
imgUpload: true
})
if (GLOBAL_CONFIG.lightbox === 'null') return
artalkItem.on('list-loaded', () => {
artalkItem.ctx.get('list').getCommentNodes().forEach(comment => {
const $content = comment.getRender().$content
btf.loadLightbox($content.querySelectorAll('img:not([atk-emoticon])'))
})
})
if (isShuoshuo) {
window.shuoshuoComment.destroyArtalk = () => {
destroyArtalk()
if (el.children.length) {
el.innerHTML = ''
el.classList.add('no-comment')
}
}
}
btf.addGlobalFn('pjaxSendOnce', destroyArtalk, 'destroyArtalk')
btf.addGlobalFn('themeChange', artalkChangeMode, 'artalk')
}
const loadArtalk = async (el, pageKey) => {
if (typeof Artalk === 'object') initArtalk(el, pageKey)
else {
await btf.getCSS('https://lib.baomitu.com/artalk/2.9.1/Artalk.min.css')
await btf.getScript('https://lib.baomitu.com/artalk/2.9.1/Artalk.min.js')
initArtalk(el, pageKey)
}
}
if (isShuoshuo) {
'Artalk' === 'Artalk'
? window.shuoshuoComment = { loadComment: loadArtalk }
: window.loadOtherComment = loadArtalk
return
}
if ('Artalk' === 'Artalk' || !false) {
if (false) btf.loadComment(document.getElementById('artalk-wrap'), loadArtalk)
else setTimeout(loadArtalk, 100)
} else {
window.loadOtherComment = loadArtalk
}
})()