Edit: Jan 3, 2022. As VSCode is mentioned several times. Go to settings in VSCode and type files.eol in the search field and set to \n (Unix format). Note that this changes this setting for your user or workspace for all files and it may not be what you want. YMMV.
I am using cygwin and Windows7, the trick was NOT to put the set -o igncr into your .bashrc but put the whole SHELLOPTS into you environment variables under Windows. (So nothing with unix / cygwin...) I think it does not work from .bashrc because "the drops is already sucked"as we would say in german. ;-)So my SHELLOPTS looks like this
Download ✏ ✏ ✏ https://t.co/Y3sQpBMDKL
If you using Git on Windows, make sure you selected 'Checkout as-is' during setup. Then make sure that you run: git config --global core.autocrlf false, so Git will not perform any conversions when checking out or committing text files.
However, it is probably a best practice to set your text editor to save files that you plan to use in a Unix/Linux environment to have a Unix text format. The answers given above for Notepad++ are a good example.
Additional note: If you are unsure what type a file is (DOS or Unix), you may use the file filename.sh. This can especially help in debugging more obscure issues (such as encoding issues when importing SQL dumps that come from Windows).
The commands specified in the sudoers file must be fully qualified (i.e. using the absolute path to the command to run) as described in the sudoers man page. Providing a relative path is considered a syntax error.
If the command ends with a trailing / character and points to a directory, the user will be able to run any command in that directory (but not in any sub-directories therein). In the following example, the user user can run any command in the directory /home/someuser/bin/:
As an alternative to editing the /etc/sudoers file, you could add the two lines to a new file in /etc/sudoers.d e.g. /etc/sudoers.d/shutdown. This is an elegant way of separating different changes to the sudo rights and also leaves the original sudoers file untouched for easier upgrades.
If the ownership and/or permissions are incorrect for any sudoers file, the file will be ignored by sudo so you might also find yourself locked out in this situation. Again, you can use pkexec to fix this.
The answer mentioning to set a host confused me, as I want to be able to have a sudo user be able to run privileged commands without requiring to consider such "host aspect"; any host should work, hence I use the special ALL reserved word.
... then it is a best practice to add your configuration in its own separate file within the /etc/sudoers.d/ directory, e.g. /etc/sudoers.d/customizations. This way, you will not run into problems when an update to the original sudo package wants to change the original /etc/sudoers file and the package manager notices conflicting edits done by you.
Using the visudo command makes sure that there are no syntax erros in the file when saving it - syntax errors would otherwise make sudo fail to read all its configuration files, thereby breaking any subsequent sudo usage, effectively locking you out from any superuser usage, including fixing the syntax erros.
Now notice what happens when running the following commands: (for testing purposes, any current sudo ticket, i.e. the timespan without requiring to reenter the password, can be directly revoked/timed-out by executing sudo -k)
Notice with this configuration, any sudo user can now also run sudo reboot ... with any arguments, flags, and parameters without having to provide a password, including e.g. sudo reboot --poweroff --force.If this is not desired, but instead only sudo reboot without any arguments/flags/parameters shall be allowed, its configuration line has to be changed to ...
Originally published at: -unix-linux-configuration-file-for-syntax-errors.html
In Linux and UNIX system services are configured using various text files located in /etc/ or /usr/local/etc/ directory tree. A typical server system could have dozens of configuration files. You can check your configuration files for syntax errors without starting the server and validate all settings. In some cases, it is possible to check the sanity of specific data/config options and directories. Text files are easier to manage remotely. You can use ssh and a text editor. If there is an error in configuration, the server may not start. It may result in a disaster. This post explains how to quickly find out a syntax error for popular servers and test configuration file for syntax errors.
Rclone is a command line program to manage files on cloud storage.After download and install, continuehere to learn how to use it: Initial configuration,what the basic syntax looks like, describes thevarious subcommands, the various options,and more.
First, you'll need to configure rclone. As the object storage systemshave quite complicated authentication these are kept in a config file.(See the --config entry for how to find the configfile and choose its location.)
rclone normally syncs or copies directories. However, if the sourceremote points to a file, rclone will just copy that file. Thedestination remote must point to a directory - rclone will give theerror Failed to create file system for "remote:file": is a file not a directory if it isn't.
On most backends this is refers to the same directory asremote:path/to/dir and that format should be preferred. On a verysmall number of remotes (FTP, SFTP, Dropbox for business) this willrefer to a different directory. On these, paths without a leading /will refer to your "home" directory and paths with a leading / willrefer to the root.
This is an advanced form for creating remotes on the fly. backendshould be the name or prefix of a backend (the type in the configfile) and all the configuration for the backend should be provided onthe command line (or in environment variables).
The above examples can also be written using a connection stringsyntax, so instead of providing the arguments as command lineparameters --http-url they are provided aspart of the remote specification as a kind of connection string.
The major advantage to using the connection string style syntax isthat it only applies to the remote, not to all the remotes of thattype of the command line. A common confusion is this attempt to copy afile shared on google drive to the normal drive which does notwork because the --drive-shared-with-me flag applies to both thesource and the destination.
Note that the connection string only affects the options of the immediatebackend. If for example gdriveCrypt is a crypt based on gdrive, then thefollowing command will not work as intended, becauseshared_with_me is ignored by the crypt backend:
On Linux/macOS some characters are still interpreted inside "strings in the shell (notably \ and $ and ") so if your stringscontain those you can swap the roles of " and ' thus. (This syntaxdoes not work on Windows.)
If you supply extra configuration to a backend by command line flag,environment variable or connection string then rclone will add asuffix based on the hash of the config to the name of the remote, eg
Starting with rclone version 1.61, any Unicode numbers and letters are allowed,while in older versions it was limited to plain ASCII (0-9, A-Z, a-z). If you usethe same rclone configuration from different shells, which may be configured withdifferent character encoding, you must be cautious to use characters that arepossible to write in all of them. This is mostly a problem on Windows, wherethe console traditionally uses a non-Unicode character set - definedby the so-called "code page".
Do not use single character names on Windows as it creates ambiguity with Windowsdrives' names, e.g.: remote called C is indistinguishable from C drive. Rclonewill always assume that single letter name refers to a drive.
rclone uses : to mark a remote name. This is, however, a validfilename component in non-Windows OSes. The remote name parser willonly search for a : up to the first / so if you need to act on afile or directory like this then use the full path starting with a/, or use ./ as a current directory prefix.
Server side copies are used with sync and copy and will beidentified in the log when using the -v flag. The move commandmay also use them if remote doesn't support server-side move directly.This is done by issuing a server-side copy then a delete which is muchquicker than a download and re-upload.
Exactly what metadata is supported and what that support means dependson the backend. Backends that support metadata have a metadata sectionin their docs and are listed in the features table(Eg local, s3)
Rclone only supports a one-time sync of metadata. This means thatmetadata will be synced from the source object to the destinationobject only when the source object has changed and needs to bere-uploaded. If the metadata subsequently changes on the source objectwithout changing the object itself then it won't be synced to thedestination object. This is in line with the way rclone syncsContent-Type without the --metadata flag.
Rclone supports --metadata-set and --metadata-mapper when doingsever side Move and server side Copy, but not when doing serverside DirMove (renaming a directory) as this would involve recursinginto the directory. Note that you can disable DirMove with--disable DirMove and rclone will revert back to using Move foreach individual object where --metadata-set and --metadata-mapperare supported.
When objects are copied from backend to backend, they will attempt tointerpret system metadata if it is supplied. Metadata may change frombeing user metadata to system metadata as objects are copied betweendifferent backends. For example copying an object from s3 sets thecontent-type metadata. In a backend which understands this (likeazureblob) this will become the Content-Type of the object. In abackend which doesn't understand this (like the local backend) thiswill become user metadata. However should the local object be copiedback to s3, the Content-Type will be set correctly.
bcf7231420