I'm trying to configure the cygwin to work with TWiki, I have to input this in the Cygwin bash shell:
mount -b -s c:/...
but it doesn't recognize the "-s", I already fixed the problem with -b, it changed the syntax and now is "mount -o binary" for the "mount -b"part. But now it says unknown option with the "-s" anyone?? help?? or what does the -s mean, so I can look it up :S
I would suggest that you don't use cygwin. Strawberry perl and native GnuWin32 ports of zip/rcs etc work better.
Related
The default shell of OpenWrt is ash, but I would like to change it to fish.
When I ran chsh -s /usr/bin/fish (the absolute path of fish), it returned -ash: chsh: not found.
The I changed the first line of /etc/passwd from:
root:x:0:0:root:/root:/bin/ash
to:
root:x:0:0:root:/root:/usr/bin/fish
I could't login again (wrong password), and the system log showed:
authpriv.warn dropbear[14288]: User 'root' has invalid shell, rejected
Is there any other way to change the default shell?
(By the way, I am using a popular fork of OpenWrt instead of the official, but it doesn't seem to be the reason of this problem)
chsh -s /usr/bin/fish is correct.
But openwrt doesn't have chsh command installed.
You need to run
opkg install shadow-chsh first to install the chsh command.
Then run
chsh -s /usr/bin/fish
Finally, run
echo $SHELL to see if the replacement is successful.
Note that the above operations require root privileges to run.
Sorry for my poor English, hope you can understand.
There are two ways to solve this. You can either:
Add /usr/bin/fish to /etc/shells
This solution is provided by #glenn-jackman above in the comments.
Or:
Replacing dropbear by openssh-server
I've figured out another way: if you happen to have openssh-server installed, I would recommend you to use it as default following this tutorial.
And remember to change the first line of /etc/passwd to:
root:x:0:0:root:/root:/usr/bin/fish
When I run the following command in cygwin,
$ cygrunsrv -I cron -p C:\cygwin64\bin --args -n
I get the following error
cygrunsrv: Given path doesn't point to a valid executable
Why am I getting this error?
You only gave a folder and not a path to the executable. Besides this I wouldn't recommend to use windows paths in cygwin, this can cause errors. You should write /cygdrive/c/cygwin64/bin/something instead of C:\cygwin64\bin\something.exe
Perhaps you are looking for an
installation guide, and you would like to do something like this:
Install cron as a windows service, using cygrunsrv:
cygrunsrv -I cron -p /usr/sbin/cron -a -D
net start cron
i am trying to get folder lists from remote server, and it is not possible to mount remote server into my local computer (because of the permission issue).
i used
smbclient "//165.186.89.21/DeptDQ_141Q_FOTA" "--user=myid" -c 'ls;'
to get lists of the folder.
and the result was success.
but, actually i want to use ls -l with the above the command line
and when i try to get results using the line
smbclient "//165.186.89.21/DeptDQ_141Q_FOTA" "--user=LGE\final.lee" -c 'ls -l;'
it returns
NT_STATUS_NO_SUCH_FILE listing \-l
64000 blocks of size 16777216. 6503 blocks available
...
how should i use smbclient operator with ls -l option?
please help me!
smbclient ls does not run a native ls command, but rather invokes built-in functionality. As such, it does not support the usual options which a native, POSIX-compliant ls command would provide.
Thus, you cannot do this.
If your goal is to read metadata, consider trying the smbclient stat [filename] subcommand instead (if your server supports UNIX extensions), or smbclient allinfo [filename] (otherwise).
I am writing a shell script. The tutorial that I am reading have the first line like this :
#!/usr/bin/env bash/
but it isn't working for me. (error : no such directory)
How can I find out which bash I am using and where is it located?
Appreciate for any advice and help.
Thanks a lot. It works now.
solution is #!/usr/bin/env bash
Another problem: Why it just can't read the word 'restart'
my code in the start.sh:
#!/usr/bin/env bash/
RESTART="apachectl restart"
$RESTART
I does not work.
Usage: /usr/local/apache2/bin/httpd [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|sto p]
[-v] [-V] [-h] [-l] [-L] [-t] [-S]
Options:
-D name : define a name for use in <IfDefine name> directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)
-S : a synonym for -t -D DUMP_VHOSTS
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files
why is it like that? it seems that it can read the word restart.
Thank you all! I have fixed it now.
solution: edit the file in unix (vim/nano and whatever but not in windows)
Thank again :)
Yet another way: echo $SHELL.
If you remove the / from bash/, it should work.
You ca try the following command
which bash
at a shell. Then put
#!<the output of which bash>
To find out where bash is, issue the command:
type bash
at your command prompt. and to make sure it is always found by your script use:
#!bash
this has the problem that some other bash may be found and used, which could be security issue, but I have been doing this for years.
Remove the extra character(s) you have at the end of lines. No slash is required and
dos2unix yourscript will remove the unwanted CRs.
#!/usr/bin/env bash
Actually better would be to open a new question for your restart problem.
Most probably you are not at the directory where the restart command is
defined or restart is not in your path. Try putting the whole path.
I configured cygwin in Windows Server 2008, now we need to implement automation
I am writing a batch script to add user to cygwin\etc\passwd file using following command
mkpasswd -l -u %username% -p /home >> /etc/passwd
Please help me how to execute following cmd in batch file
echo off
C:
chdir C:\cygwin\bin
bash --login -i
mkpasswd -l -u %username% -p /home >> /etc/passwd
It's not working
You're mixing Windows and Unix in your windows batch file. The batch file is running as a Windows command, as is the mkpasswd command in it. Windows has no concept of /etc/passwd and will throw an error. Probably something like;
D:\cygwin\bin>mkpasswd -l -u testusr -p /home >> /etc/passwd
The system cannot find the path specified.
Given what you want to do with mkpasswd I'd suggest you find a way to run your automation from within Cygwin. Perhaps setting up a cron job.