error:
Access to the path '/var/www/bin/release/net5.0/publish/wwwroot/uploadimages/cplusplustimeline.png' is denied
/Blog/edit/Access to the path '/Nop.Web/bin/release/netcoreapp3.0/publish/wwwroot/uploadimages/20191218233033hkping.png' is denied.
reason:
Linux's permissions system is very different from that of Windows。
slove:
chmod -R 777 tmp
chmod -R 777 ./src/Presentation/Nop.Web/bin/release/net5.0/publish/wwwroot
Linux/Unix 是多人多工作业系统,所有的档案皆有拥有者。利用 chown 可以将档案的拥有者加以改变。
这个指令只有是由系统管理者(root)所使用,一般使用者没有权限可以改变别人的档案拥有者,也没有权限可以自己的档案拥有者改设为别人。只有系统管理者(root)才有这样的权限。
ls -l
档案类型‘d’:表示文件夹,‘-’:表示文件
chown
改变拥有者和群组
chmod
Linux/Unix 的档案调用权限分为三级 : 档案拥有者、群组、其他。利用 chmod 可以藉以控制档案如何被他人所调用
语法为:chmod abc file
其中a,b,c各为一个数字,分别表示User、Group、及Other的权限。
r=4,w=2,x=1
若要rwx属性则4+2+1=7;
若要rw-属性则4+2=6;
若要r-x属性则4+1=5。
chmod -R 777 /tmp
-R 是指级联应用到目录里的所有子目录和文件
777 是所有用户都拥有最高权限
error when copy from windows10 to vultr with xfp
root@vultr:/bin/release/net7.0/publish/wwwroot/Posts# ls -l
total 248
-
-rw-r--r-- 1 root root 1513 Nov 23 01:54 637845798258363123.xml
-rw-r--r-- 1 root root 5799 Nov 23 01:54 638047156614050243.xml
-rw-r--r-- 1 root root 3932 Nov 23 01:54 638047278404485471.xml
-rw-r--r-- 1 root root 2583 Nov 23 01:54 638047448929486135.xml
-rw-r--r-- 1 www-data www-data 14399 Nov 25 23:08 638047682030792259.xml
-rw-r--r-- 1 www-data www-data 453 Nov 24 19:48 638048107009490791.xml
-rw-r--r-- 1 www-data www-data 18076 Nov 24 19:49 638048107574380884.xml
-rw-r--r-- 1 www-data www-data 2677 Nov 25 12:10 638049163448544861.xml
-rw-r--r-- 1 www-data www-data 6187 Nov 24 22:25 638049219220030403.xml
-rw-r--r-- 1 www-data www-data 1482 Nov 25 13:51 638049681104127070.xml
-rw-r--r-- 1 www-data www-data 2948 Nov 25 14:13 638049804271330524.xml
drwxr-xr-x 2 root root 4096 Nov 22 22:57 files
# chown www-data:www-data *
output
#ls -l
-rw-r--r-- 1 www-data www-data 2583 Nov 23 01:54 638047448929486135.xml
-rw-r--r-- 1 www-data www-data 14399 Nov 25 23:08 638047682030792259.xml
-rw-r--r-- 1 www-data www-data 453 Nov 24 19:48 638048107009490791.xml
-rw-r--r-- 1 www-data www-data 18076 Nov 24 19:49 638048107574380884.xml
-rw-r--r-- 1 www-data www-data 2677 Nov 25 12:10 638049163448544861.xml
-rw-r--r-- 1 www-data www-data 6187 Nov 24 22:25 638049219220030403.xml
-rw-r--r-- 1 www-data www-data 1482 Nov 25 13:51 638049681104127070.xml
-rw-r--r-- 1 www-data www-data 2948 Nov 25 14:13 638049804271330524.xml
drwxr-xr-x 2 www-data www-data 4096 Nov 22 22:57 files
Nopcommerce 4.x 发布到Linux后运行出现错误:
An error occurred while trying to encrypt the provided data. Refer to the inner exception for more information.
ystem.Security.Cryptography.CryptographicException: An error occurred while trying to encrypt the provided data. Refer to the inner exception for more information. ---> System.UnauthorizedAccessException: Access to the path '/var/www/aspnetcore46/Grand.Web/bin/release/netcoreapp3.1/publish/App_Data/DataProtectionKeys/5c38e39f-ce45-4a26-acd8-1a5f0092d906.tmp' is denied. ---> System.IO.IOException: Permission denied --- End of inner exception stack trace --- at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository.StoreElementCore(XElement element, String filename) at Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository.StoreElement(XElement element, String friendlyName) at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IInternalXmlKeyManager.CreateNewKey(Guid keyId, DateTimeOffset creationDate, DateTimeOffset activationDate, DateTimeOffset expirationDate) at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.CreateNewKey(DateTimeOffset activationDate, DateTimeOffset expirationDate) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore(DateTimeOffset now, IKey keyJustAdded) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore(DateTime utcNow, Boolean forceRefresh) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect(Byte[] plaintext) --- End of inner exception stack trace --- at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect(Byte[] plaintext) at Microsoft.AspNetCore.Session.CookieProtection.Protect(IDataProtector protector, String data) at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at Grand.Framework.Middleware.InstallUrlMiddleware.InvokeAsync(HttpContext context, IWebHelper webHelper) in /var/www/msly/mslyaspnetcoregrandnode46/Grand.Framework/Middleware/InstallUrlMiddleware.cs:line 50 at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
bin/release/netcoreapp3.1/publish/App_Data/DataProtectionKeys目录没有读写权限
chmod -R 777 DataProtectionKeys