# Ubuntu 20.04 使用Dante建立socks5代理 **Published by:** [亏快链](https://paragraph.com/@0x849505419f1f3993f3d9e2ccf278ac9164199452/) **Published on:** 2022-08-28 **URL:** https://paragraph.com/@0x849505419f1f3993f3d9e2ccf278ac9164199452/ubuntu-20-04-dante-socks5 ## Content 一、安装Dantesudo apt update sudo apt install dante-server 输入如下命令查看Dante服务状态[会显示失败,因为安装后配置文件未修改]systemctl status danted.service 可以看到输出了 Active: failed 和一堆告警; 会显示失败,因为安装后配置文件未修改。 接下去进行配置文件的修改。二、配置DanteDante的配置文件为/etc/danted.conf ,因原文件内容说明内容较多,接下去步骤会全部删除原文件内容,先备份原配置文件。cp /etc/danted.conf /etc/danted.conf.bak 然后将/etc/danted.conf 中的内容全部替换为以下内容【如下,必须修改external: 补充填写IP;建议修改port=1080为其他端口】logoutput: stderr user.privileged: root user.unprivileged: nobody #The listening network interface or address.如下端口尽量更改为其他端口 internal: 0.0.0.0 port=1080 #The proxying network interface or address. external: 补充填写IP #socks-rules determine what is proxied through the external interface. socksmethod: username #client-rules determine who can connect to the internal interface. clientmethod: none client pass { from: 0.0.0.0/0 to: 0.0.0.0/0 } socks pass { from: 0.0.0.0/0 to: 0.0.0.0/0 } 三、配置登录用户名和密码 配置登录用户名sudo useradd -r -s /bin/false username #写个自己喜欢的用户名 为用户名配置密码sudo passwd username #注意这里是为新加的用户设置密码,根据提示设置密码和确认密码,即可完成 四、启动danted服务执行以下命令启动danted服务sudo systemctl restart danted.service 查看服务状态systemctl status danted.service 查看端口监听情况,通过端口查看,验证danted服务是否正常;查看配置的端口1080(或你修改后的端口是否存在)netstat -tunpl 五、代理连接测试(1)使用curl测试(Linux和windows均需自己安装,这一步非必需)curl -v -x socks5://username:password@server_ip:1080 http://www.baidu.com/ username和password均是刚才设置的,显示类似如下图,为正常。(2)使用chrome浏览器进行socks5代理访问网站,通过插件代理插件SwitchyOmega来验证。 ## Publication Information - [亏快链](https://paragraph.com/@0x849505419f1f3993f3d9e2ccf278ac9164199452/): Publication homepage - [All Posts](https://paragraph.com/@0x849505419f1f3993f3d9e2ccf278ac9164199452/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@0x849505419f1f3993f3d9e2ccf278ac9164199452): Subscribe to updates