xftp无法创建文件夹

今天用xftp连接了一下 自己创建得系统

发现使用怎么也创建不了文件

原因是 你使用得账号权限不够!!!
在这里插入图片描述
在这里插入图片描述

除了home下 得权限是自己得 其他权限都是root

这个时候想要创建文件只能使用root账号登录

但是默认情况下 是不允许直接使用root账号登录

使用root账号登录

1、编辑vim /etc/ssh/sshd_config文件

把PermitRootLogin Prohibit-password 添加#注释掉
新添加:PermitRootLogin yes
更改PermitEmptyPasswords为 no (这个可能已经是no)
在这里插入图片描述

2、然后重启ssh服务

service ssh restart(或者执行:/etc/init.d/ssh restart)

3、重启服务器

shutdown -r now

这样就可以直接使用root账号登录

但是如果还没有对root账号设置登录密码 可以先使用xshell通过

sudo passwd root 命令来设置密码

  • 1
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
以下是使用C#创建FTP文件的示例代码: ```csharp using System; using System.Net; class Program { static void Main(string[] args) { string ftpFolderName = "newFolder"; // 要创建的文件名称 string ftpServerIP = "ftp://ftp.example.com"; // FTP服务器地址 string ftpUserID = "username"; // FTP登录用户名 string ftpPassword = "password"; // FTP登录密码 try { // 创建FTP请求对象 FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpServerIP + "/" + ftpFolderName); request.Method = WebRequestMethods.Ftp.MakeDirectory; request.Credentials = new NetworkCredential(ftpUserID, ftpPassword); // 发送FTP请求 FtpWebResponse response = (FtpWebResponse)request.GetResponse(); Console.WriteLine("FTP文件创建成功!"); response.Close(); } catch (WebException ex) { FtpWebResponse response = (FtpWebResponse)ex.Response; if (response.StatusCode == FtpStatusCode.ActionNotTakenFileUnavailable) { Console.WriteLine("FTP文件已存在!"); } else { Console.WriteLine("FTP文件创建失败:" + ex.Message); } } } } ``` 该示例代码使用`FtpWebRequest`类创建FTP请求对象,并设置请求方法为`WebRequestMethods.Ftp.MakeDirectory`,表示创建文件。然后设置FTP登录用户名和密码,并发送FTP请求。如果文件已存在,则会捕获`WebException`异常,并判断异常状态码是否为`FtpStatusCode.ActionNotTakenFileUnavailable`,如果是,则表示文件已存在,否则表示创建文件失败。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值