change the user:owner, if want to write any file from root to hdfs directly
sudo -u hdfs hdfs dfs -chown root:hdfs /user/file --{/file}
sudo -u hdfs hdfs dfs -chmod -R 775 /user/file
Or
sudo -u hdfs hdfs dfs -chown -R hdfs:hadoop /user/file
sudo -u hdfs hdfs dfs -chmod -R 1777 /user/file
then use put command
sudo -u hdfs hdfs dfs -put /root/project/* /file --{/user/file}
works for me
[root@spark ~]# sudo -u hdfs hdfs dfs -put /root/project/* /file/
put: `file/': No such file or directory
[root@spark ~]# hdfs dfs -put /root/project/* /file
put: Permission denied: user=root, access=WRITE, inode="/file":hdfs:hadoop:drwxr-xr-t
[root@spark ~]# sudo -u hdfs hdfs dfs -chown root:hdfs /file
[root@spark ~]# hdfs dfs -put /root/project/*.csv /file
[root@spark ~]# hdfs dfs -ls /file
Found 12 items
rw-r--r-- 1 root hdfs 4662272 2019-04-28 06:23 /file/StokKs.csv
rw-r--r-- 1 root hdfs 302648 2019-04-28 06:23 /file/Stocks.csv
rw-r--r-- 1 root hdfs 284628 2019-04-28 06:23 /file/Stocks.csv
rw-r--r-- 1 root hdfs 568949 2019-04-28 06:23 /file/Satellite.csv
rw-r--r-- 1 root hdfs 579302 2019-04-28 06:23 /file/Stocks.csv
rw-r--r-- 1 root hdfs 24805721 2019-04-28 06:23 /file/medical.csv
rw-r--r-- 1 root hdfs 5650234 2019-04-28 06:23 /file/bank.csv
rw-r--r-- 1 root hdfs 2893092 2019-04-28 06:23 /file/facebook.csv