Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
23
votes
5
answers
141946
views
Invalid cross-device link while Hardlinking in the same file system
I have **/home/myuser/Desktop/rc/.netrc** file that i want hardlink to **/root**, ie home directory of **root** user. When i do: `ln /home/user/Destkop/rc/.netrc /root` it gives the following error: > ln: creating hard link `/root/.netrc' => `.netrc': Invalid > cross-device link but it works when i...
I have **/home/myuser/Desktop/rc/.netrc** file that i want hardlink to **/root**, ie home directory of **root** user.
When i do:
ln /home/user/Destkop/rc/.netrc /root
it gives the following error:
> ln: creating hard link /root/.netrc' =>
.netrc': Invalid
> cross-device link
but it works when i hardlink the file to **myuser**'s home, ie to **/home/myuser**.
So, what's the problem, why it says invalid cross-devices when there is only one file system here?
**PS.** I am using **RHEL6**
Elvin Aslanov
(387 rep)
Jun 12, 2013, 09:48 AM
• Last activity: Jul 19, 2025, 11:33 AM
8
votes
2
answers
1634
views
ncftp not looking into .netrc
I have this sort of stanza in my `.netrc`: machine ftp.mydomain.com login mylogin password mypassword and while I can successfully connect with `ftp`: ftp ftp.mydomain.com and passing credentials to `ncftp`: ncftp -umylogin -pmypassword ftp.mydomain.com I get this using only `ncftp ftp.mydomain.com`...
I have this sort of stanza in my
.netrc
:
machine ftp.mydomain.com
login mylogin
password mypassword
and while I can successfully connect with ftp
:
ftp ftp.mydomain.com
and passing credentials to ncftp
:
ncftp -umylogin -pmypassword ftp.mydomain.com
I get this using only ncftp ftp.mydomain.com
NcFTP 3.2.4 (May 16, 2010) by Mike Gleason (http://www.NcFTP.com/contact/) .
Connecting to xxx.xxx.0.140...
ProFTPD 1.3.1 Server (Debian) [::ffff:xxx.xxx.0.140]
Login incorrect.
Sleeping 20 seconds...
neurino
(1839 rep)
Jan 30, 2013, 05:28 PM
• Last activity: Mar 25, 2023, 01:59 PM
3
votes
4
answers
6225
views
Can lftp read netrc for sftp-connections
I am trying to create a script to upload some files to a server via SFTP. I can do that manually by opening an interactive lftp-session and providing username and password there. For the script, I would like to - not hardcode credentials in the script (for obvious reasons) - not mention them on the...
I am trying to create a script to upload some files to a server via SFTP. I can do that manually by opening an interactive lftp-session and providing username and password there. For the script, I would like to
- not hardcode credentials in the script (for obvious reasons)
- not mention them on the commandline (I want the command in my .bash_history, but of course not the credentials)
- have
lftp
read the credentials from .netrc
or something similar
I cannot seem to get this working. My current workaround is a wrapper-script that parses the .netrc
for the credentials and adds them to a lftp-script which I delete afterwards. This simulates the steps I perform manually, but seems like re-implementing existing functionality poorly. While this works, the question remains:
> Can lftp read .netrc for SFTP-connections?
If so, are there special syntax-requirements if customs ports are part of the setup? I need to connect to sftp://username:password1@example.com:12322
.
kronn
(399 rep)
Apr 30, 2016, 03:42 PM
• Last activity: Dec 11, 2021, 07:44 AM
5
votes
1
answers
24023
views
CURL request using .netrc file
I am trying to write a script which is saving the credentials to a .netrc file and then it is reading from the file in order to pass them to a curl command and saves the returned cookie file for future use. I am interested if this is secure way to pass the username and password and if there is a man...
I am trying to write a script which is saving the credentials to a .netrc file and then it is reading from the file in order to pass them to a curl command and saves the returned cookie file for future use. I am interested if this is secure way to pass the username and password and if there is a man in the middle attack would they be able to sniff the credentials if the server which I am trying to reach is over HTTP.
#!/bin/bash
IP="192.168.0.1"
user="Administrator"
pass="Password1234"
function credentials {
mkdir "${HOME}"/.netrc
rm "${HOME}"/.netrc/credentials.txt
touch "${HOME}"/.netrc/credentials.txt
{ echo "machine ${IP}"; echo "login ${user}"; echo "password ${pass}"; } >> "${HOME}"/.netrc/credentials.txt
chmod 600 "${HOME}"/.netrc/credentials.txt
}
function cookie {
curl -v -c cookie.txt -n "${HOME}"/.netrc/credentials.txt http://"${IP}"/setup.php
}
credentials
cookie
I have checked and the credentials.txt file is properly saved in the corresponding directory and the credentials have the right permissions, but when I try to run the cookie function, I got the following error:
't find host 192.168.0.1 in the .netrc file; using defaults
. Why curl is not able to fetch the configured username and password from the credentials.txt file?
Georgi Stoyanov
(860 rep)
Mar 5, 2018, 01:14 PM
• Last activity: Oct 28, 2021, 11:43 AM
0
votes
1
answers
1181
views
Why does curl -n fail in one script but not others?
Why does curl -n fail in one script but not others? curl 7.67.0 running on MacOS High Sierra The following code in one script: host="ftp.xxxxxx.com/public_html/" /opt/local/bin/curl -n -T $file $host -v Gives me this: > USER xxxx PASS xxxxxxxxxx > USER anonymous PASS ftp@example.com 0 0 0 0 0 0 0 0...
Why does curl -n fail in one script but not others?
curl 7.67.0 running on MacOS High Sierra
The following code in one script:
host="ftp.xxxxxx.com/public_html/"
/opt/local/bin/curl -n -T $file $host -v
Gives me this:
> USER xxxx
PASS xxxxxxxxxx
> USER anonymous
PASS ftp@example.com
0 0 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0< 530 Login authentication failed
* Access denied: 530
Both scripts are bash scripts and located in the same directory of the same machine. There is only one .netrc file. Obviously it is OK as one script uses it with success. The curl code and host variable are the same. In fact, the code in the first script was copied directly from the second script.
How do I figure out why one curl command can use the .netrc file but the other can’t? There must be something in the second script that causes the curl failure, but I have no idea what it might be.
Buadhai
(257 rep)
Dec 29, 2019, 06:37 AM
• Last activity: Dec 29, 2019, 06:51 AM
2
votes
1
answers
680
views
Character encoding of .netrc
Does anyone know which character encoding is used in `.netrc`? As a German user, I sometimes put umlauts in passwords. So my question is, are these treated as latin1 or may I assume that I am doing fine encoding the file in UTF-8?
Does anyone know which character encoding is used in
.netrc
? As a German user, I sometimes put umlauts in passwords.
So my question is, are these treated as latin1 or may I assume that I am doing fine encoding the file in UTF-8?
Mirko Friedenhagen
(123 rep)
Mar 25, 2014, 09:56 PM
• Last activity: Aug 4, 2016, 11:31 PM
2
votes
1
answers
5499
views
Specify anonymous ftp password in ftp command
I would like a simple (ideally one-liner, without separate script file) command to connect to an ftp server via anonymous login using my email address as the password. My attempt is based on the syntax [as shown here][1] of basically `ftp username:password@hostname`; however this does not work for m...
I would like a simple (ideally one-liner, without separate script file) command to connect to an ftp server via anonymous login using my email address as the password.
My attempt is based on the syntax as shown here of basically
ftp username:password@hostname
; however this does not work for me when the password itself, being an email address, has an @ sign..
I also tried to provide a netrc file as a heredoc, as so: ftp hostname -N <<< 'login anonymous password user@email.com'
but this still prompts me for a password during the ftp login..
Daniel Naftalovich
(123 rep)
Oct 11, 2015, 10:37 PM
• Last activity: Oct 12, 2015, 06:24 AM
Showing page 1 of 7 total questions